4 ms·
Little-known directives of Angular.js
- plus- 13y agoWell, I didn't even know about ng-cloak
- throwmeaway2525 13y agoFunny!
- wmil 13y agong-bind-html-unsafe has been removed in the latest release candidates, it won't be in 1.2 So try not to get attached.
- welder 13y agoJust use http://docs.angularjs.org/api/ng.$sce#methods_trustashtml http://docs.angularjs.org/api/ng.$sce#methods_trustashtml on your data then use ng-bind-html. It does the same as ng-bind-html-unsafe.
- wmil 13y agoIterating over a collection in the controller and manually calling that on each element as needed is a huge pain. Does it work in filters?
- sheerun 13y agoYeah, I mentioned it in comment under the post.
- mcv 13y agoI'll be looking into ui-view. I need different view options.
- altcognito 13y ago> "Angular performs validation of HTML5 input types out of the box." I'm confused. What does angular have to do with this?
- ceejayoz 13y agoAngular adds $valid/$invalid for forms that you can check against.
- mmac 13y agongPluralize - Handles pluralization scenarios cleanly in your view. No more "var itemCountDesc = items.length + ' Item' + items.length === 1 ? '' : 's';"
- kurtfunai 13y agoThanks for the post - I regularly use a lot of these, and I'm a big fan of ng-bind attribute over the <div>{{ thing }}</div> approach. Things that really caught my eye: - ng-list: sounds very useful for user forms, tagging, etc - ng-switch: I dont know how many times I've used ng-show to replicate this functionality. Thank you!
- d4vlx 13y agoNot that I can really take much credit but you're welcome :)
- mmorris 13y agoJust to be clear (and as mentioned in a comment on the post), ng-switch is actually closer in functionality to using multiple ng-if directives (which is only in Angular 1.1.5+). ng-switch actually adds/removes the elements from the DOM, whereas ng-show just shows/hides the element.
- Rodeoclash 13y agoIt also creates an additional scope whereas the ng:show does not.
- metastew 13y agoWhat does "Flash Of Uncompiled Content" means?
- tlunter 13y agoRefers to when the page renders and still shows {{ user }} instead of the content that should really be shown in place of it.
- deleted 13y ago[deleted]
- oinksoft 13y agoOld small post I wrote on this: https://oinksoft.com/blog/view/2/ https://oinksoft.com/blog/view/2/
- SanderMak 13y agoTo see an example of the sibling comments, see http://branchandbound.net/blog/web/2013/08/some-angularjs-pitfalls/ http://branchandbound.net/blog/web/2013/08/some-angularjs-pi...
- jasdeepsingh 13y agongBind was new for me today. Thank you!
- crucialfelix 13y agoui-view does indeed look quite interesting. but the description didn't really explain it for me. a simplified description is that its a router for multiple-panes. where different related states can make use of inheritance. http://txt.fliglio.com/2013/05/angularjs-state-management-with-ui-router/ http://txt.fliglio.com/2013/05/angularjs-state-management-wi... http://jsfiddle.net/benschwartz/LhydD/ http://jsfiddle.net/benschwartz/LhydD/
- sheerun 13y agoI like your description. Indeed one of the best things about ui-view is that states can be inherited. Say you want to load search.results.details, and it will render search page first, then results inside, then details. Also, in sub-states you can use templates defined in parent-state template. It means you don't need to render cache templates all at once. Just for sub-states.
- ffrryuu 13y agong-attr is very nice