1
내가 AngularJS와의 온라인 과정을하고있어 그들이 이런 컨트롤러를 작성하는 것이 좋습니다 :
컨트롤러 :
app.controller("TestController", function() {
this.printable = "Hello, World";
});
보기 :
홀수<div ng-controller="TestController as test">
<h1>{{ test.printable }}</h1>
</div>
, 내가 읽은 다른 모든 튜토리얼은 컨트롤러를 다음과 같이 쓸 것을 제안한다 :
app.controller("TestController", ["$scope", function($scope) {
$scope.printable = "Hello, World";
});
두 가지 접근 방식의 차이점은 무엇입니까?
우리가 그 맥락에 대해 더 많이 알기 때문에 당신이 따르고있는 코스의 이름을 짓는 것이 유용 할 것입니다. – mpm
감사합니다. @ErikKronberg - 다른 답변보다 훨씬 좋습니다. – CodingIntrigue
@RGraham 네, 대단한 답변입니다! –