Bonjour, I'd like to manipulate DOM (launch directive) only when a specific page (route+controller) is triggered. In my app.js, it seems I can only lanch directive when app.js is called (always). How could I do it ? Merci, S.
I would lazy load the directive using for example the ocLazyLoad plugin https://github.com/ocombe/ocLazyLoad.
$stateProvider.state('app.controller', { url: '/', resolve: { loadMyService: ['$ocLazyLoad', function ($ocLazyLoad) { return $ocLazyLoad.load({ name: 'app.directive.myDirective', files: ['scripts/myDirective.js'] }); }] } });
You could also create a onRouteChange to detect the route inside the directive