BanksySan
BanksySan

Reputation: 28500

Importing scripts into AngularJS view

I have a view as below:

<headers>
    <h1>My Page</h1>
</headers>

<link rel="stylesheet" href="css/some.css"/>

<script ng-src="js/my-view-script.js"></script>

However, when the view is loaded the script isn't fetched. I've also tried <script src="js/my-view-script.js"></script> and had the same trouble.

So, how do I load a script file for a single view only?

CHeers

Dave

Upvotes: 0

Views: 83

Answers (1)

Svilen
Svilen

Reputation: 2648

Try loading jQuery before AngularJS:

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

I remember seeing it somewhere that jqLite (which is used by Angular) doesn't support that.

Upvotes: 1

Related Questions