3 ms·
Ractive.JS doesn't need $scope.$apply because it uses it's own model system. AngularJS doesn't use it's own model system, the model is a plain old JavaScript ob
by nawitus 13y ago
Ractive.JS doesn't need $scope.$apply because it uses it's own model system. AngularJS doesn't use it's own model system, the model is a plain old JavaScript object. The author of 'Frameworkless JavaScript' criticizes the Ember way of using a "complex model system".
$scope.$apply exist because of limitations in JavaScript. Apparently this will be fixed in ES6, so ES6-version of AngularJS theoretically won't need $scope.$apply.
Ractive.JS's data-binding looks similar to Ember.js, which also has it's own model system to learn (learning complex frameworks was criticized in the article).
- nailer 13y agoRactive uses POJSOs. Each binding has a POJSO (ie, an Object, nothing magical, no new inheritance system or unrelated class-based OO system) and a template (in mustache format). That's all. You can make the binding live specifying 'magic: true' which requires ES5 (a reasonable requirement for modern web apps).
- nawitus 13y agoI stand corrected. I thought you needed ES6 for that, but apparently ES5 is nearly enough. I didn't read about Ractive.js's magic mode. It's not automatic data-binding either, according to the docs[1]: 'Magic mode only works with properties that Ractive already knows about.' 1. http://docs.ractivejs.org/latest/magic-mode http://docs.ractivejs.org/latest/magic-mode AngularJS works with properties that it doesn't know about, if you use $apply.$scope.
- dodyg 13y agoThe thing is it's better set things manually so the boundary between your DOM data and other parts of the application become clear. There's no chance of mistaking this.set('keypath', data) with something else.
- nawitus 13y agoI don't think the model should care about the view. It should be possible to change the model without caring about view, or even knowing if a view exists. A view should be able to use the model, but the model shouldn't care.
- dodyg 13y agoIt's just data for ractive.js to display on the DOM. There's no assumption on whether this is a Model, a View Model or whatever pattern you adopt for your app.