What is the difference between a normal ng-controller and a controller inside a directive.
<div ng-controller="MyCtrl">
<directive></directive>
</div>
Below i have a directive inside MyCtrl and my directive also has a controller defined.
var app = angular.module('myApp',[]);
app.directive('map', function() {
return {
restrict: 'E',
controller: function(){}
}
});
function MyCtrl($scope) {}
- What is the difference between a normal
ng-controllerand acontrollerinside a directive. - Why does the
directivehave acontrollerfunction?.
Aucun commentaire:
Enregistrer un commentaire