Live data from Hacker News

Little-known directives of Angular.js

codetunes.com

11–20 of 24 posts

Re: Little-known directives of Angular.js

#15
ui-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-wi...

http://jsfiddle.net/benschwartz/LhydD/

Re: Little-known directives of Angular.js

#16
post #4

ng-bind-html-unsafe has been removed in the latest release candidates, it won't be in 1.2 So try not to get attached.

Just use 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.

Re: Little-known directives of Angular.js

#18

Thanks for the post - I regularly use a lot of these, and I'm a big fan of ng-bind attribute over the {{ thing }} 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!

Not that I can really take much credit but you're welcome :)

Re: Little-known directives of Angular.js

#20

ui-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-wi... http://jsfiddle.net/benschwartz/LhydD/

I 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.

Post reply on HN