I have a variable I'm setting in my view with ng-init
which I am then trying to access in my controller. When I try to access it however, I'm getting an undefined
.
Relevant pieces of code:
My view:
<div ng-controller="MyCtrl">
<div ng-init="pageTitle = 'kittens'">
</div>
</div>
My controller:
var MyCtrl;
MyCtrl = function($scope) {
return console.log($scope.pageTitle);
};
What am I missing here?