javascript - How to define a controller for a directive in a separate js file? -
.directive('directivename', ['$scope', function ($scope) { return { restrict: 'e', templateurl: 'templateurl/abc.html', scope: { name: '@', flag: '=' }, controllerurl: 'controllerurl/xyz.html' } }]);
while defining directives in angularjs, there way specify url controller of directive? (similar defining templateurl
) controllerurl
parameter maybe?
you can create controller in file , use controller: 'name-of-controller'
. make sure file controller located gets imported in index.html
Comments
Post a Comment