as
为什么人们在angularjs中使用$scope.ms = 'something'
?我通常只是注入$ scope并执行Module VBModule
Sub Main()
Dim x As Decimal = 1.25
Dim y As Decimal = 1.25
Dim z As Long = (x+y)
Console.WriteLine(z)
End Sub
End Module
答案 0 :(得分:2)
如果你这样做,你不需要注射$scope
<h1 ng-controller="mainController as mainCtrl">{{mainCtrl.ms}}</h1>
app.controller("mainController", function() {
this.ms = "hi";
});
更好地解释here。
编辑:AngularJS官方文档中也提到了这一点。请参阅ngController。