On Github troch / angular-data-binding
app.directive('input', function () {
return {
restrict: 'E',
scope: false,
link: function (scope, element, attrs) {
element.bind('input', function (event) {
scope.$apply(function () {
scope.model = element.val();
});
});
}
};
});
Object.observe(myObj, function observer(changes) {
/* Do something */
changes.forEach(function (change) {
console.log(change.name, change.type, change.oldValue);
});
});
// Object.observe(myObj, function observer(changes) {
// changes.forEach(function (change) {
// console.log(change.name, change.type, change.oldValue);
// });
// });
$scope.$watch(watchExpression, function listener(newValue, oldValue) {
// Do something
console.log(newValue, oldValue);
});
// Apply changes: execute function and call $digest
$scope.$apply(function () {
$scope.myModel = 'Hello';
});