I'm a total newbie to javascript. Was just wondering what is the difference between the following when using the controllerAs approach, and why the second approach doesn't work:
angular.module("app")
.controller("angularController", angularController);
function angularController() {
this.hello = "hello";
this.goodbye = "goodbye";
}
and
angular.module("app")
.controller("angularController", angularController);
function angularController() {
var hello = "hello";
var goodbye = "goodbye";
return {
hello: hello,
goodbye: goodbye
}
}