Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

i've written a fairly large angular app, and the ng-if case struck me as totally incomprehensible (why the hell would ng-if have its own scope ?). Then i realized i've never had to use ng-if.

That's not to minimize the trouble you get when you first have to learn about scope inheritance, but I think ng-if may be the only completely non-intuitive directive of the framework. (As opposed to something like let's say ng-repeat, where you sort of get the intuition that some care will be needed).



I don't think that's even a scope issue...

ng-model will auto-create scope variables if they don't exist. That's a handy shortcut.

But if you have two inputs that can auto-create variable you're asking for trouble, and you should probably initialize it on the scope constructor.

Or at the very least, use an ng-init so that you know where it will be created.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: