-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
Description
Hi,
I think there is a mistake in controllerAs with vm -> [Style Y032] section, I can't reproduce the example.
HTML
<div class="container" ng-controller="TestController as d">
<input type="text" ng-model="d.title">
</div>
From the styleguide
var vm = this;
this.vm = "Hi";
$scope.$watch('vm.title', function(current, original) {
$log.info('vm.title was %s', original);
$log.info('vm.title is now %s', current); // Nothing happen, when I typing
});
But that works (from the tuto controllerAs http://toddmotto.com/digging-into-angulars-controller-as-syntax/)
var vm = this;
vm.title = "";
$scope.$watch(function () {
return vm.title;
}, function (current, original) {
$log.info('vm.title was %s', original);
$log.info('vm.title is now %s', current);
});
Am I wrong or not ?
Thanks !