In the Controller:
// Instead of doing this:
app.controller('TodoCtrl', function ($scope) {
$scope.input = 'ex. buy milk';
});
// Do this:
app.controller('TodoCtrl', function () {
this.input = 'ex. buy milk';
});
In the HTML:
<!-- Instead of this: -->
<div ng-controller="TodoCtrl">
<input type="text" ng-model="input" />
</div>
<!-- Do this: -->
<div ng-controller="TodoCtrl as todo">
<input type="text" ng-model="todo.input" />
</div>
Posted to makandra dev (2014-12-06 10:45)