Last active
May 20, 2016 12:27
-
-
Save jbmilgrom/036624776381158b98c4493014c2217d 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.firstTeam = [{ | |
first: 'steph', | |
last: 'curry' | |
}, { | |
first: 'lebron', | |
last: 'james' | |
}]; | |
$scope.$watchCollection('firstTeam', function(firstTeamArray) { | |
console.log("change to the first team! ", JSON.stringify(firstTeamArray)); | |
}); | |
$timeout(function() { | |
$scope.firstTeam.push({first: 'russel', last: 'westbrook'}); | |
}); // new member, print! | |
$timeout(function() { | |
$scope.firstTeam.sort(function(player1, player2) { | |
if (player1.first < player2.first) return -1; | |
}); | |
}, 300); // reordering, print! | |
$timeout(function() { | |
$scope.firstTeam[0].height = 75; | |
}, 600); // member mutation, no print |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment