Last active
May 22, 2016 15:57
-
-
Save jbmilgrom/2edc4071c01f70b32a81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope.$watch('obj1', function callback(newValue) { | |
console.log('obj1: ', newValue); | |
}); | |
// (when initialized) prints out: undefined | |
$timeout(function() { | |
scope.obj1 = {name: 'jonathan'}; // prints out: {name: 'jonathan'} | |
}); | |
$timeout(function() { | |
scope.obj1.name = 'michael'; // no "change" registered, no print out | |
}, 500); | |
$timeout(function() { | |
scope.obj1.age = 30; // no "change" registered, no print out | |
}, 1000); | |
$timeout(function() { | |
// it's a new object! | |
scope.obj1 = {name: 'jonathan'}; // prints out: {name: 'jonathan'} | |
}, 1500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment