Skip to content

Conversation

@jardix22
Copy link
Contributor

@jardix22 jardix22 commented Aug 1, 2014

No description provided.

@jardix22 jardix22 changed the title Added empty templates for list page and panel #128 Added empty templates for list page and panel to resolve #128 Aug 1, 2014
@jardix22 jardix22 changed the title Added empty templates for list page and panel to resolve #128 Added empty templates for list page and panel #128 Aug 1, 2014
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use ng-show="!items.length" instead of ng-if="items.$empty". This doesn't require changing the controller.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "list-group-item" class and change "no-items" to "empty".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think "items.length" will work. "items" is, indeed, a object mapping "[id] => [object item]" and therefore it has no "length" property. Also, "items" has other properties with names that start with "$" (like "$promise"), what is automatically ignore by angular on ng-repeats, so you can see it is not really a common object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@recidive ng-show="!items.length" doesn't work, i tested this and @lucasconstantino have reason.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I was searching for a workaround for this and thought briefly we were working with arrays.

I feel this search for "$" a little fragile, was wondering if we could use some AngularJS API method for lopping through this, or maybe a lodash one?

@recidive
Copy link
Owner

recidive commented Aug 2, 2014

Hello @jardix22, great patch. I've added some line notes. It looks like the change in the controller is not really necessary.

Please make the changes and update the pull request, then I'll review it and merge it in ASAP.

Thanks!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could use $scope.items.hasOwnProperty(key); for checking if the property is local or inherited.

Joseph Ramos added 5 commits July 29, 2015 13:35
…tions/choko into fs/empty-template-for-list

Conflicts:
	applications/default/public/js/controllers.js
	applications/default/public/templates/list-group.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants