Skip to content

Instantly share code, notes, and snippets.

@leoallen85
Created March 8, 2016 11:14
Show Gist options
  • Save leoallen85/102de33380a078ee2867 to your computer and use it in GitHub Desktop.
Save leoallen85/102de33380a078ee2867 to your computer and use it in GitHub Desktop.
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