HN2new | past | comments | ask | show | jobs | submitlogin

Yes, that slide is still a bit of a work in progress.

You can certainly use D3 (or any other library) alongside Ractive, though things could go awry if two libraries were trying to manipulate the same bit of the page at the same time - e.g. if an element has a style attribute like style='left: {{left}}px;' and D3 modifies the element's style, D3's changes will only last until the value of {{left}} is updated.



So what is ractive.js's equivalent of $scope.$apply ? $scope.$apply is used for this specific purpose, to notify angular of any external changes.


$scope.$apply is necessary because sometimes changes to the model happen outside Angular's event loop.

Ractive doesn't have this issue because updates always happen explicitly with ractive.set( 'key', value ) (or with array mutator methods). It's not quite as magical as Angular's frictionless updates, but it gives you slightly more control (e.g. you can do ractive.animate( 'key', value ) and so on), without needing to inherit from custom observable classes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: