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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -