

Little-known directives of Angular.js - d4vlx
http://codetunes.com/2013/little-known-angular-directives/

======
kurtfunai
Thanks 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!

~~~
mmorris
Just 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
It also creates an additional scope whereas the ng:show does not.

------
mmac
ngPluralize - Handles pluralization scenarios cleanly in your view. No more
"var itemCountDesc = items.length + ' Item' \+ items.length === 1 ? '' : 's';"

------
crucialfelix
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://txt.fliglio.com/2013/05/angularjs-state-management-with-ui-
router/)

[http://jsfiddle.net/benschwartz/LhydD/](http://jsfiddle.net/benschwartz/LhydD/)

~~~
sheerun
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.

------
altcognito
> "Angular performs validation of HTML5 input types out of the box."

I'm confused. What does angular have to do with this?

~~~
ceejayoz
Angular adds $valid/$invalid for forms that you can check against.

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

~~~
welder
Just 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
Iterating over a collection in the controller and manually calling that on
each element as needed is a huge pain.

Does it work in filters?

------
mcv
I'll be looking into ui-view. I need different view options.

------
metastew
What does "Flash Of Uncompiled Content" means?

~~~
tlunter
Refers to when the page renders and still shows

{{ user }}

instead of the content that should really be shown in place of it.

------
plus-
Well, I didn't even know about ng-cloak

~~~
throwmeaway2525
Funny!

------
jasdeepsingh
ngBind was new for me today. Thank you!

------
ffrryuu
ng-attr is very nice

