See the . inside that model name? That means unless someone does really dumb things with the dependency injector, the two models will always refer to the same thing. There is no magic here--this is basic JavaScript prototypal inheritance. You have this exact same "problem" (I use the term loosely) whenever you read JavaScript code.
His rant about the "magic" dependency injector is noted, well received, and being fixed. So it's a non-issue.
His point about the digest loop, is just plain stupid. How else would you build it? Because that's literally what every UI framework does currently--including the browser his site is being rendered on. If he has some magic means of changing that, then please, by all means, enlighten the rest of us. That being said, the "magic number" of 2000 was never a magic number, and it was a misinterpretation, and it's also just plain wrong. And it's not relevant to today's Angular, which includes one-time bindings. And more importantly, it won't be necessary in the future with Object.observe.
His points about the documentation describing things strangely has been an active focus of fixing. But he's missed the point, once again, on some of this: people redefine terms all the time. It's part of being a living language.
And for his final point, he's once again missed the fact that this is being fixed. I'll be the first to admit that the fix seems a little clunky (requiring support for something that doesn't exist and won't exist in ES6 at this point), but frankly doing token-based injection as a concept is much better than the existing argument-based (ultimately string-based) injection.
See the . inside that model name? That means unless someone does really dumb things with the dependency injector, the two models will always refer to the same thing.
The point was:
If you type into the first input field first, the two inputs will share the same model. If you type into the second one first, they will have distinct models.
Like the author of the stackoverflow comment says, "It doesn't work the way most people expect it should work."
Because that's literally what every UI framework does currently
That's not really true.. React, Vue, Ractive are the ones that comes to mind that doesn't use a digest loop. I'm sure there's plenty other..
[...] people redefine terms all the time. It's part of being a living language.
But that's the problem, Angular is not a language, it's a framework.
But yeah, all those things are "getting" fixed... in 2.0? When is that going to be released? Will it be easy to upgrade?
I've think you missed the point of this article. At the current state of angular, the author doesn't think Angular is a good framework, and I agree with him. "Being fixed" is not a pros, it's a cons until it's fixed, released and tested.
And is utterly and completely wrong. The . is what makes that not the case--it forces the prototype lookup to access the expected variable, rather than creating the new one. That's why the author is wrong.
That's not really true.. React, Vue, Ractive are the ones that comes to mind that doesn't use a digest loop. I'm sure there's plenty other..
None of those are UI frameworks. And they do, in fact, all do the same thing that Angular will be doing, which is iterating over the things that are known to have changed and then notifying subscribers.
But that's the problem, Angular is not a language, it's a framework.
A framework written by people. People are the ones redefining the things, not the framework.
But yeah, all those things are "getting" fixed... in 2.0? When is that going to be released? Will it be easy to upgrade?
Some of them earlier, some of them later. Things are still in flux for exactly these reasons.
At the current state of angular, the author doesn't think Angular is a good framework
And a good reviewer/journalist/whatever he wants to call himself would have called out the things that are in flux. But he did none of that.
All of this being said, I'm a fan of stripping apart Angular (which they're already doing) and just using Web Components for the frontend UI (which I can do by not including the templating engine). Angular has drastically shifted my thinking on managing UI componentization, and Web Components has only reinforced that.
The . is what makes that not the case--it forces the prototype lookup to access the expected variable, rather than creating the new one.
I'm sorry, but a framework is supposed to make developing easier. Anything that forces me to understand the underlying technology in depth to understand the reason my magical 2-way binding doesn't work when I edit the second input first, is pretty bad. Javascript is a language with a lot of quirks, a framework should be helping you overcome those quirks - not make you discover new ones.
None of those are UI frameworks.
If you check http://facebook.github.io/react/, it says "A Javascript library for building user interfaces". It's actually just a UI framework. Maybe you could elaborate what UI means to you.
And they do, in fact, all do the same thing that Angular will be doing, which is iterating over the things that are known to have changed and then notifying subscribers.
They don't do it with by dirty checking. Enormous difference.
A framework written by people. People are the ones redefining the things, not the framework.
Not sure what you want to state here. The official documentation state those terms.
And a good reviewer/journalist/whatever he wants to call himself would have called out the things that are in flux.
Why? The point is not if Angular can one day be a great framework. It's if Angular is a great framework now. When I build a project, I don't think "hmmm this is a crappy framework, but they're going to fix it in 2 years, so I'll choose it".
I'm sorry, but a framework is supposed to make developing easier. Anything that forces me to understand the underlying technology in depth to understand the reason my magical 2-way binding doesn't work when I edit the second input first, is pretty bad. Javascript is a language with a lot of quirks, a framework should be helping you overcome those quirks - not make you discover new ones.
Then JavaScript is not the right language for you. Have you looked into one of the cross-compiled languages? There's an abundance of those these days. Also, did you even look at the plunker link I provided? It works exactly as expected.
They don't do it with by dirty checking. Enormous difference.
Care to explain how they update the actual rendered layer, if not by enumerating the things that changed and updating the relevant things? Dirty checking doesn't have to involve enumerating all the watched things to find the subset of changed things to be called as such.
If you check http://facebook.github.io/react/, it says "A Javascript library for building user interfaces". It's actually just a UI framework. Maybe you could elaborate what UI means to you.
Sorry, that was a half-formed thought that I was in the process of revising when I got distracted.
What I was trying to say is that you need some sort of render loop, and some sort of update loop, and the update loop has to--at a minimum--look at the changed things and update their state for the render loop to pick up. The two loops can be the same (and in JavaScript land, they are). All basic rendering frameworks work this way (including Angular, though it has some deficiencies currently due to language constraints).
Not sure what you want to state here. The official documentation state those terms.
People define a language. People write using that language. People can change the meaning of the language. That doesn't make what they've said wrong, just incongruous with other people's expectations. They've taken the time to explain the context even. Whether or not this is a good thing, I make no judgment call.
Why? The point is not if Angular can one day be a great framework. It's if Angular is a great framework now. When I build a project, I don't think "hmmm this is a crappy framework, but they're going to fix it in 2 years, so I'll choose it".
Because unless you're building something that will completely disappear and you'll stop maintaining 3 months from now, future support and direction matters.
Then JavaScript is not the right language for you.
Yes, it is. Angular is just not the correct framework. I've used it, backtracked, and rewrote my app in React. I've also tried Coffeescript, Typescript, and Dart.
The designers of software frameworks aim to facilitate software development by allowing designers and programmers to devote their time to meeting software requirements rather than dealing with the more standard low-level details of providing a working system
It's a loop that checks if a variable has been modified. If you have 2000 variables in the scope that is being watched, even though you're not modifying the variables, the loop is running and checking for modification. No matter how you look at it, this is a not optimal.
In angular, you do
$scope.model.name = 'Michael';
And it magically changes it in the frontend.
In backbone, you do
model.set({
name: 'Michael'
});
Backbone does this because Object.observe() is not widespread yet.
Doesn't matter what the browser do, cause it has to do it. The framework is another story.
Because unless you're building something that will completely disappear and you'll stop maintaining 3 months from now, future support and direction matters.
Google is the worst indication, then. They've dropped so many projects already, and they don't use angular for user-facing projects.
The apply is to notify angular that you need to run a new digest. The timeout is because if you try to run $apply while a digest is currently running, you get an error and nothing happens. so the timeout puts the $apply in the event queue for later. Totally hacky.
The UI element binds to a property through an interface, when the property gets set, it fires an event, by which the UI gets notified, it then reevaluates the property by its accessor to get the new value. This is the basic idea, implementation detail you can look at dependency object, dependency property and binding classes.
That's a "digest loop". And that's also not how it works. From Wikipedia:
Periodically, MIL walks the tree and executes the rendering instructions in each node, thus compositing each element on to a DirectX surface, which is then rendered on screen.
...
All WPF applications start with two threads: one for managing the UI and another background thread for handling rendering and repainting.
What you described is the render loop. What I said is about how ui elements get updated information from their logical representation. To achieve this, angularjs use digest loop, it has nothing to do with Dom rendering. Wpf uses event on the other hand.
-3
u/lord2800 Nov 05 '14
He's missed part of the point. Short of very bad design, this is always resolvable by reading the source code:
See the
.inside that model name? That means unless someone does really dumb things with the dependency injector, the two models will always refer to the same thing. There is no magic here--this is basic JavaScript prototypal inheritance. You have this exact same "problem" (I use the term loosely) whenever you read JavaScript code.His rant about the "magic" dependency injector is noted, well received, and being fixed. So it's a non-issue.
His point about the digest loop, is just plain stupid. How else would you build it? Because that's literally what every UI framework does currently--including the browser his site is being rendered on. If he has some magic means of changing that, then please, by all means, enlighten the rest of us. That being said, the "magic number" of 2000 was never a magic number, and it was a misinterpretation, and it's also just plain wrong. And it's not relevant to today's Angular, which includes one-time bindings. And more importantly, it won't be necessary in the future with
Object.observe.His points about the documentation describing things strangely has been an active focus of fixing. But he's missed the point, once again, on some of this: people redefine terms all the time. It's part of being a living language.
And for his final point, he's once again missed the fact that this is being fixed. I'll be the first to admit that the fix seems a little clunky (requiring support for something that doesn't exist and won't exist in ES6 at this point), but frankly doing token-based injection as a concept is much better than the existing argument-based (ultimately string-based) injection.