You've got to love this post on CodeMentor.io comparing Angular 1.x with ReactJS
https://www.codementor.io/reactjs/tutorial/react-vs-angularjs
A lot to find out about ReactJS. Proponents say it is more scalable AND faster using a virtual DOM than Angular with its 2000 $watch limit, but it also re-introduces html mixing with JS! Many would consider that an anti-pattern and not conducive to UI Testing. What about MeteorJS? Is that going to be a better framework? Would Angular 2.0 become the de-facto popular framework come late 2016? Guess, we will all find out in the not too distant future.
Showing posts with label AngularJS. Show all posts
Showing posts with label AngularJS. Show all posts
Sunday, March 22, 2015
Sunday, September 28, 2014
Did you know - AngularJS custom Service and Promise trivia
If you are writing a custom Angular service that says goes out and
the .then() promise will actually end up returning another promise that you can wire up to in your controller(where you are using this custom service). Also, note that in this scenario you are likely to use the revealing module pattern - like using a factory to return an object that you need instantiate, in order to use the custom service. This is different from the regular service singleton you get when using the built-in angular services.
- does a $http.get() and
- uses .then() promise
the .then() promise will actually end up returning another promise that you can wire up to in your controller(where you are using this custom service). Also, note that in this scenario you are likely to use the revealing module pattern - like using a factory to return an object that you need instantiate, in order to use the custom service. This is different from the regular service singleton you get when using the built-in angular services.
Sunday, December 29, 2013
Knockout Computed Observables
F = C * 9/5 + 32
Knockout with its computed observables can track related dependencies, so if one changes, the other also changes automagically. Ember has a similar thing with .property syntax, but struggles with multiple dependencies.
var C = ko.observable(0);
var F = ko.computed( function() {
return C() * 9/5 + 32;
});
Angular however with its dirty checking has no way of knowing if either one changes, so recomputes the function below if any property on $scope changes.
$scope.C = 0;
$scope.F = function() {
return $scope.C * 9/5 + 32;
}
Here Angular does not know that the property F which is a function, is dependent on property C.
So with dirty checking Angular actually goes and recomputes this value anytime anything changes on $scope, even if it is not C or F. So it is wasted computing if you look at it this way.
Note: ES6 Harmony could change all this once observable properties are added to browser capabilities natively.
Subscribe to:
Posts (Atom)