0

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

3
  • Can you post your partial code? Commented Nov 18, 2013 at 15:43
  • Could you by any chance make use of $inject? docs.angularjs.org/api/AUTO.$injector Commented Nov 18, 2013 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 Commented Nov 18, 2013 at 16:12

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.