AngularJS 지시문에 컨트롤러를 정의하는 두 가지 방법이 있다는 것을 알고 있습니다. 컨트롤러는 controller:
옵션을 사용하여 지시문 정의의 일부로 정의 할 수 있습니다. 또는 지시문 templateURL:'someview.html'
의보기에 필수 컨트롤러가 포함될 수 있습니다. 누구나이 두 가지 옵션의 차이점과 사용시기를 설명 할 수 있습니까? 지시어 내에서AngularJS 지시문 제어기 정의
:
app.directive('myDirective', function() {
templateUrl: 'someview.html,
controller: 'MyController' ----> either here
});
someview.html
<div ng-contoller='my-controller'> ----> or here
</div>