Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

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

share|improve this question
    
Can you post your partial code? – Davin Tryon Nov 18 '13 at 15:43
    
Could you by any chance make use of $inject? 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 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.