4 ms·
Yesterday, I spent 8 hours writing an AngularJS directive for setting focus on an input field. You know, last year we used to just document.getElementById('myfi
by Geee 13y ago
Yesterday, I spent 8 hours writing an AngularJS directive for setting focus on an input field. You know, last year we used to just document.getElementById('myfield').focus(), but it's much more reusable and maintainable with a custom 'focusable' directive.
If you want to learn more about the subject: http://stackoverflow.com/questions/14833326/how-to-set-focus-in-angularjs http://stackoverflow.com/questions/14833326/how-to-set-focus...
- camus2 13y agoSome stuffs are definetly difficult to do,but the advantages outweight the disavantages in most cases.
- carsongross 13y agomuch more reusable and maintainable <sarc/>?
- zoomerang 13y agoIf you can solve something in jQuery, why are you using Angular? Wrong tool for the job. If you have an application that otherwise uses Angular, and you have a snippet of jQuery code that you want to use, wrapping it in a directive takes about 30 seconds. Alternatively, if you don't want to write a directive, you can just run the jQuery code directly as if Angular didn't even exist.
- collyw 13y agoBecause the cool kids are all using Angular and NoSQL.
- chazu 13y agoTo me, a large part of the value proposition behind angular is in a) making your app as declarative as possible and b) isolating resuable and imperative code in modules (directives or services in the parlance of angular).