4 ms·
This looks like a good resource. But number 28 is wrong: > Always have a ‘.’ in your ng-models which insures prototypal inheritance. That isn't what that does
by lars 11y ago
This looks like a good resource. But number 28 is wrong:
> Always have a ‘.’ in your ng-models which insures
prototypal inheritance.
That isn't what that does. The egghead.io Angular videos also get this wrong. I really think that the vast majority of Angular programmers don't really understand how its scoping works. I've ranted about this before [1], it's just ridiculously complex.
Some scopes inherit prototypically from their parents, and others don't, and you can't tell or affect it from the markup. The dot just means you're referring to a property of an object on the scope. If the object is somewhere in the scope inheritance chain, two directives attached at different points in that chain can share data by pointing to the object. If the object isn't there, what the name points to is actually non-deterministic. Ng-model silently creates it, and the point in the chain at which it creates it depends on which directive wanted to write to the property, which might depend on the order in which the user interacts with the different elements on the page.
[1]: http://larseidnes.com/2014/11/05/angularjs-the-bad-parts/ http://larseidnes.com/2014/11/05/angularjs-the-bad-parts/
- aikah 11y ago> Whatever the reason is for Angulars popularity, it isn’t that it’s a great framework. Anything that makes programmers productive is a great tool. Angular 1.x definitely makes teams productive. It's one of the first web framework that comes with a specific testing framework. The clear separation between the DOM and the business logic makes apps more testable. And I could go for hours. Angular helps developers write complex apps faster and better. Sure it isn't perfect, but show me something better with all the features AngularJs has. AngularJS didn't became popular because it was from Google, a simple proof is the closure widget library nobody uses outside google. AngularJS became popular because it was obviously superior in term of developer experience. Now your point about ng-model and scopes is valid.But it's not a angular problem, it's a javascript issue.Ultimately to understand angular you need to understand how javascript works, which many develpers don't. Instead of saying "this thing is bad", Educate them. But I guess sensationalism drives more clicks.
- lars 11y agoI got tons of both hate and love for that blog post. One of the few criticisms that I can accept is the "The problems are real, but don't matter that much." view. I don't agree, but I suppose people can have different experiences there. Any 'sensationalism' comes from legitimate anger with the framework, after having spent over a year working with it on a large project. > Now your point about ng-model and scopes is valid.But it's not a angular problem, it's a javascript issue. This I don't agree with. Yes, JavaScript has prototypical inheritance between objects, but certainly not between scopes. It has lexical scoping like everyone else. The decision to have scopes be objects that (sometimes, not always) inherit from one another, is entirely on Angular. So is the decision to have ng-model silently create objects on this scope.
- smokeyj 11y ago> after having spent over a year working with it on a large project What issues are you running into? I always hear people complain about angular but rarely hear why.
- julie1 11y agoMost people don't understand directives, so they resort to a pub/sub communication model that makes the web page unable to scale when you have too much items that are binded/coupled on a page. No optimizations are possible for an exponentially resource greedy problem.
- lars 11y agoI just linked my multi page blog post describing the problems I ran into.
- ralfn 11y ago> The decision to have scopes be objects that (sometimes, not always) inherit from one another, is entirely on Angular It's almost as if they try to shoehorn a custom adhoc programming language straight into your dom-nodes, but they couldn't be that stupid, right?
- 11y ago
- gooseus 11y agoSome feedback; your article on angular is awful. It's got some good information on some pieces of angular that more people should have a better understanding of, yes. However, trying to absorb that information through the shouting and sensational ranting is almost impossible. This same article could have been written by a level-headed coder who understands the complexity of making a widely distributed browser frameworks and it would have been called "5 Angular Idiosyncrasies" or "Tricky Angular Patterns". But no, sensationalism sells and loud, strident claims win the day. Why have humility and get less clicks when you can write a scathing takedown using strawman arguments and style yourself the next Crockford? Your points are entirely valid criticisms, but your language and attitude make you sound like a blowhard trying to prove something or a shill promoting a competing framework with negative press.
- lars 11y agoFWIW, my tone in that article is exactly the tone I would have if you got me started on this in a real life conversation. If I sound like a blowhard, at least I'm an authentic blowhard, it's not some act I put on for the clicks. The tone comes from being legitimately angry at these flaws in Angular, but also from having to discover them myself, instead of reading about them on someone else's blog. The various JavaScript frameworks affect hundreds of thousands of developers every day, and choosing the wrong one can cost companies a lot of money. I really think that as a profession we'd make progress faster if more people wrote angry blog posts about things that are bad.
- chvid 11y agoYour article is solid and I am grateful that you wrote it. And I understand your tone completely. When a framework is oversold in a major way those who try to use it on real life projects get very frustrated.
- chrislgrigg 11y agoI appreciate a human, conversational approach to technical information and applaud you for your blog's tone. If you were writing for a professional news site it might be inappropriate but as a post on your own blog, you're entitled to whatever writing style you want.
- ufo 11y agoSheesh, I never got into angular because the "DI by parameter name" thing seriously bugged me but had no idea that the variable scoping in models could depend on the order that the inputs are used! How can people live with that?
- LocalPCGuy 11y agoInteresting article, although I feel that some of your time may have been better spent submitting the changes you felt (like for documentation) as pull requests to help make it better, rather than just ripping on it.