AngularJS Style Guide
11–20 of 41 posts
Re: AngularJS Style Guide
#12That said, this style guide definitely has the strongest (almost convincing) argument I've seen for using controllerAs and does not have the inconsistencies I've found in other guides (`this` is not bound to `$scope` as a couple popular guides claim). Good stuff.
Re: AngularJS Style Guide
#13Very helpful. I've unsuccessfully search for a way to do one-time binding before in a data intensive application and never came across the {{::ctrl.foobar}} syntax. One thing I'm hesitant about is their advice to use directives instead of ng-controller="MyCtrl". Since controllers really are app specific glue code I rarely find myself wanting to reuse them - what advantages are directives supposed to give here?
You can easily get one-time bindings using https://github.com/kseamon/fast-bind , which supports not only one-time bindings but also updating a binding only when called. This makes it easy to work with data that doesn't change, promises, or large amounts of data that rarely changes. Karl Seamon did a great talk about performance this past January at ng-conf as well, https://www.youtube.com/watch?v=zyYpHIOrk_Y
Re: AngularJS Style Guide
#14Re: AngularJS Style Guide
#15Earlier quoted context omitted.
You can easily get one-time bindings using https://github.com/kseamon/fast-bind , which supports not only one-time bindings but also updating a binding only when called. This makes it easy to work with data that doesn't change, promises, or large amounts of data that rarely changes. Karl Seamon did a great talk about performance this past January at ng-conf as well, https://www.youtube.com/watch?v=zyYpHIOrk_Y
Yeah that was a great talk, definitely worth watching for those looking for ways to improve the performance of their Angular apps. Do you know of any other videos like that? I've searched in the past but haven't come up with much (especially not for stuff relevant to latest versions of Angular)
As to newer stuff, I believe Karl is specifically talking about 1.2 (might of been a release candidate or beta at the time) so his talk should be applicable to the newest stable version, and I've found that to be true so far.
As an aside, and I haven't objectively measured it or even really investigated it, it seems angular's 1.x stable versions aren't coming out as fast as they once did (it feels like 1.3 has been in rc/beta forever and 2.0 doesn't even seem to be out of the planning stages). So at this point I think 1.3 stable will be released in the next few months and hopefully they will have an updated talk on performance at the next ng-conf in March.
Re: AngularJS Style Guide
#16Todd Motto's angular style guide [1] has been one of the most helpful to me. It's always good to read multiple style guides and cherry-pick what works best for you :) [1]: https://github.com/toddmotto/angularjs-styleguide
The recommendations in the module section are pretty awful - I'd avoid doing so, and every other expert in the community I've spoken to also disagree with that suggestion of using global functions wrapped in an IIFE to prevent it from being published on window, which seems to exclusively come out of Google.
Re: AngularJS Style Guide
#17Meh. NgAnnotate is way better than duplicating code. Be DRY, not pedantic.
Re: AngularJS Style Guide
#18Meh. NgAnnotate is way better than duplicating code. Be DRY, not pedantic.
Re: AngularJS Style Guide
#19Earlier quoted context omitted.
Yeah that was a great talk, definitely worth watching for those looking for ways to improve the performance of their Angular apps. Do you know of any other videos like that? I've searched in the past but haven't come up with much (especially not for stuff relevant to latest versions of Angular)
I haven't really found any videos as comprehensive as this, just blog posts or videos that discuss one topic/strategy at a time. Outside of this video, there doesn't seem to be an authoritative or even comprehensive list of what can be done to speed up applications. As to newer stuff, I believe Karl is specifically talking about 1.2 (might of been a release candidate or beta at the time) so his talk should be applica…
Re: AngularJS Style Guide
#20Earlier quoted context omitted.
The recommendations in the module section are pretty awful - I'd avoid doing so, and every other expert in the community I've spoken to also disagree with that suggestion of using global functions wrapped in an IIFE to prevent it from being published on window, which seems to exclusively come out of Google.
What does IIFE stand for? From your I'm guessing it's an immediately evaluating function - but I can't figure the initialism out