Created
March 8, 2016 11:14
-
-
Save leoallen85/102de33380a078ee2867 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
counterApp.controller('CounterCtrl', function(){ | |
// You'll need to explain this | |
var self = this; | |
// Start with basic two-way data binding | |
self.count = 0; | |
// Now add buttons | |
self.increment = function() { | |
self.count++; | |
}; | |
// Now get them to build this using a basic app, and add decrement | |
// Now add a second counter | |
// Now add five counters | |
self.decrement = function() { | |
self.count--; | |
}; | |
}); | |
counterApp.controller('CounterModelCtrl', function(){ | |
var self = this; | |
self.counters = [{count: 0}, {count: 0}]; | |
// Now add buttons | |
self.increment = function(counter) { | |
counter.count++; | |
}; | |
// Now get them to build this using a basic app, and add decrement | |
// Now add a second counter | |
// Now add five counters | |
self.decrement = function(counter) { | |
counter.count--; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment