-
Notifications
You must be signed in to change notification settings - Fork 9
Added empty templates for list page and panel #128 #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Added empty templates for list page and panel #128 #137
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
|
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! |
There was a problem hiding this comment.
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.
…tions/choko into fs/empty-template-for-list Conflicts: applications/default/public/js/controllers.js applications/default/public/templates/list-group.html
No description provided.