3 ms·
Nice writeup! I'm using angular now on a work project for the first time. My observation here is the same as what I've had for many "look how easy it is!" fra
by sequoia 13y ago
Nice writeup! I'm using angular now on a work project for the first time.
My observation here is the same as what I've had for many "look how easy it is!" frameworks: A lot of frameworks sport "look how easy it is!" syntax, but using the easy/short syntax actually isn't adequate in some (sometimes most) circumstances, and often it isn't even "recommended."
So you start using the longer, more explicit syntax, and all those short/sweet syntax features are out the window.
For example, the easy-to-read {{obj.prop}} data-binding syntax is basically dis-recommended here with three workarounds given (use ng-cloak, declare databindings on element attributes, externalize & `include` the offending markup). Once you have 3 different workarounds for what's basically the most fundamental framework feature, I can't help but wonder "why offer this short/sweet/brittle syntax in the first place? Most 'power users' can't really use it." The dep injection one in particular- basically any shop worth its salt is going to use a minifier on big JS applications- none of them (us) can use the short dep injection syntax. Why even teach it/include it at all?
I guess it gets people up & running faster, but eventually you have to deal with these pitfalls.
- oinksoft 13y agoWhy even teach it/include it at all? I fear that other developers will read a comment like this three months down the road and take it hook, line, and sinker. It is in line with the narrative that AngularJS and similar tools hide their complexity/inflexibility, and that the up-front examples are marketing fluff. I know I am guilty of this when I look to comments like this one for the "on the ground" perspective. Real-world AngularJS applications use multiple templates and {{ o.p }}. {{ o.p }} is the recommended way to render scope 99% of the time. ngmin[1] solves the DI minification/annotation problem transparently and is trivial to integrate into any existing build process. [1] https://github.com/btford/ngmin https://github.com/btford/ngmin
- sequoia 13y agotake it hook, line, and sinker. :( I'm not a framework developer at all, just a user; this is just my observation. Maybe it's incorrect or poorly informed, just how it appears to one person. Anyway I'm not trying to sell anyone anything, neither am I a fisher of men, so feel free to spit out my tackle. :)
- oinksoft 13y agoPerhaps then the lure leads to a tree branch, snarled by a poor cast from another angler earlier :) I didn't mean to imply devious presentation on your part.
- numbsafari 13y agoIt's a valid point when you consider that PHP has suffered from the fact that just about every tutorial starts by showing how to use the mysql package (which still hasn't been purged). If it doesn't work for a real working app, the feature is either broken or shouldn't be a feature at all.
- greaterweb 13y agoOnce you have 3 different workarounds for what's basically the most fundamental framework feature I wouldn't call ngCloak[1] a work around, it's part of the framework and specifically meant to handle this sort of thing. Use of the ngInclude[2] is more aligned with my personal preference on how I organize and setup my projects. The reality is though, if you are using Angular to drive your entire page (aka, everything is part of a single Angular app), the use of ngView[3] goes hand and hand to work with your routing. This brings in the view template for the route in the same way an ngInclude would for other parts of the page. I'm drawing off my own experience in Angular development and looking at the basic examples given. If there are more complex examples that illustrate UI flicker as a real problem I'd certainly like to see them. [1] http://docs.angularjs.org/api/ng.directive:ngCloak http://docs.angularjs.org/api/ng.directive:ngCloak [2] http://docs.angularjs.org/api/ng.directive:ngInclude http://docs.angularjs.org/api/ng.directive:ngInclude [3] http://docs.angularjs.org/api/ng.directive:ngView http://docs.angularjs.org/api/ng.directive:ngView
- wnevets 13y agoIIRC the only place the mustache syntax has a FOUC is in the main index.html file. Everywhere else is fine, directive templates, partials, etc. So it makes perfect sense to teach and show off that nice syntax . http://youtu.be/ZhfUv0spHCY http://youtu.be/ZhfUv0spHCY