`.directive('counter', function counter() {
return {
scope: {},
bindToController: {
count: '='
},
controller: function () {
function increaseCount() {
this.count++;
}
function decreaseCount() {
this.count--;
}
this.increaseCount = increaseCount;
this.decreaseCount = decreaseCount;
},
controllerAs: 'counter',
template: [
'<div class="todo">',
'<input type="text" ng-model="counter.count">',
'<button type="button" ng-click="counter.decreaseCount();">-</button>',
'<button type="button" ng-click="counter.increaseCount();">+</button>',
'</div>'
].join('')
};
});
`
I attempted to use $apply in toddmotto's jsfiddle for reference, but it did not work as expected.
Any assistance would be greatly valued.