<h1 ng-controller="mainController as mainCtrl">{{ms}}</h1>
.controller("mainController",function(){
this.ms = "hi";
});
Why are people using as in angularjs? What I usually do is just inject $scope and do $scope.ms = 'something'
You don't need to inject $scope if you do this
<h1 ng-controller="mainController as mainCtrl">{{mainCtrl.ms}}</h1>
app.controller("mainController", function() {
this.ms = "hi";
});
Better explained here.
EDIT: It's mentioned in AngularJS Official Docs as well. See ngController.