0

I have an AngularJS application using ui-router that ng-repeats a piece of partial html that looks something like this

<div 
  class="event-tile"
  ng-class="{
    'first': (first), 
    'last': (last), 
    'full-width': (first && desktop)
  }">

  <script src="//xyz.com/script"></script>

</div>

Everything works great, but the script within the script tag isn't being triggered. It's on the page, but never runs. Is there anyway to trigger it to run?

I've tried solutions at Why ng-scope is added to javascript inline of my partial view and makes alert not working? but didn't work nevertheless.

Community
  • 1
  • 1
Luke
  • 1,053
  • 2
  • 16
  • 26
  • maybe the script doesn't execute anything useful until e.g. it hears a `DOMContentLoaded` event that will not occur again – Plato Jun 24 '16 at 23:25
  • Better you can replace the script content with a directive – Anand Jun 25 '16 at 05:02

2 Answers2

0

It feels like nothing related to Angular.

You should write some simple code into your script, like console.log("Foo") to test if it works or not. I made a simple test just now and found it work properly. More like the problem of your xyz.com/script. Better paste your code and we can have a further answer.

Kroderia
  • 623
  • 4
  • 15
0

It looks like including jQuery before AngularJS solved the issue.

Luke
  • 1,053
  • 2
  • 16
  • 26