I am very new to angular and cant seem to figure this out.
In my controller I am using the var vm = this
syntax rather than using $scope
but when trying to attach an $on
event handler I get a vm.$on
is not a function error.
This works:
$scope.$on('$viewContentLoaded', function () {
console.log(vm.myform);
});
This does not:
var vm = this;
vm.$on('$viewContentLoaded', function () {
console.log(vm.myform);
});
could some please explain why.
Thanks James