News for hackers. Stuff that matters.
Re:Little-known directives of Angular.js by kurtfunai on Wednesday November 06, 2013 @11:27AM (#6683493)
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!

Re:Little-known directives of Angular.js by mmorris on Wednesday November 06, 2013 @02:34PM (#6684902)
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.
Re:Little-known directives of Angular.js by Rodeoclash on Wednesday November 06, 2013 @04:42PM (#6685710)
It also creates an additional scope whereas the ng:show does not.
Re:Little-known directives of Angular.js by d4vlx on Wednesday November 06, 2013 @01:24PM (#6684343)
Not that I can really take much credit but you're welcome :)
Re:Little-known directives of Angular.js by mmac on Wednesday November 06, 2013 @10:57AM (#6683292)
ngPluralize - Handles pluralization scenarios cleanly in your view. No more "var itemCountDesc = items.length + ' Item' + items.length === 1 ? '' : 's';"
Re:Little-known directives of Angular.js by crucialfelix on Wednesday November 06, 2013 @12:34PM (#6683926)
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 by sheerun on Wednesday November 06, 2013 @01:45PM (#6684528)
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.

Re:Little-known directives of Angular.js by altcognito on Wednesday November 06, 2013 @10:49AM (#6683256)
> "Angular performs validation of HTML5 input types out of the box."

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

Re:Little-known directives of Angular.js by ceejayoz on Wednesday November 06, 2013 @10:57AM (#6683300)
Angular adds $valid/$invalid for forms that you can check against.
Re:Little-known directives of Angular.js by wmil on Wednesday November 06, 2013 @10:23AM (#6683115)
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.

Re:Little-known directives of Angular.js by welder on Wednesday November 06, 2013 @12:40PM (#6683962)
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 by wmil on Wednesday November 06, 2013 @03:34PM (#6685318)
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?

Re:Little-known directives of Angular.js by sheerun on Wednesday November 06, 2013 @01:35PM (#6684442)
Yeah, I mentioned it in comment under the post.
Re:Little-known directives of Angular.js by mcv on Wednesday November 06, 2013 @10:38AM (#6683188)
I'll be looking into ui-view. I need different view options.
Re:Little-known directives of Angular.js by metastew on Wednesday November 06, 2013 @11:28AM (#6683502)
What does "Flash Of Uncompiled Content" means?
Re:Little-known directives of Angular.js by tlunter on Wednesday November 06, 2013 @11:35AM (#6683543)
Refers to when the page renders and still shows

{{ user }}

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

Re:Little-known directives of Angular.js by oinksoft on Wednesday November 06, 2013 @12:34PM (#6683923)
Old small post I wrote on this: https://oinksoft.com/blog/view/2/
Re:Little-known directives of Angular.js by SanderMak on Wednesday November 06, 2013 @03:12PM (#6685148)
To see an example of the sibling comments, see http://branchandbound.net/blog/web/2013/08/some-angularjs-pi...
Re:Little-known directives of Angular.js by plus- on Wednesday November 06, 2013 @10:05AM (#6683011)
Well, I didn't even know about ng-cloak
Re:Little-known directives of Angular.js by throwmeaway2525 on Wednesday November 06, 2013 @10:08AM (#6683035)
Funny!
Re:Little-known directives of Angular.js by jasdeepsingh on Wednesday November 06, 2013 @11:46AM (#6683615)
ngBind was new for me today. Thank you!
Re:Little-known directives of Angular.js by ffrryuu on Wednesday November 06, 2013 @12:47PM (#6684017)
ng-attr is very nice