I am using angular.js for my project and adding script in a partial or view but it is not working. I want to include script for single partial only so i don't want to add that script on the index page. Is there any way to include single script for a partial or view in angular.js
Asked
Active
Viewed 3,389 times
0
-
Can you post your partial code? – Davin Tryon Nov 18 '13 at 15:43
-
Could you by any chance make use of $inject? http://docs.angularjs.org/api/AUTO.$injector – Lauri Elias Nov 18 '13 at 15:56
-
answer depends on what type of code you have...is it a new controller/directive etc? Or some DOM manipulation code...need more details – charlietfl Nov 18 '13 at 16:12
1 Answers
0
This seems pretty similar to this question AngularJS: How to run additional code after AngularJS has rendered a template?
Accordng to this, your best bet might be to use $evalAsync()
http://docs.angularjs.org/api/ng.$rootScope.Scope#$evalAsync
Although that kind of depends on what the code you're trying to run is (post it pls?). My advice is try to "angularize" whatever you're trying to do after the template has loaded so that you can include it in your controller. If that doesn't work, then look for other solutions.

Community
- 1
- 1

NicolasMoise
- 7,261
- 10
- 44
- 65