Domanda

So I apologize in advance if this has been answered, tried my best to look through similar stacks, but basically I'm curious about the scope of ngInclude functionality.

Does it have a single purpose as the question poses, as a partial template render feature?

Or could I set up a partial with an angular script embedded that would run on implementation on a different URI/route, given that page serves up Angular as well.

I'm looking for an optimal way of sharing angular interface across services other than using an iframe for example.

È stato utile?

Soluzione

My best understanding of the angular ng-include is that it doesn't run scripts by default which means you really can't include new directive definitions or other angular/javascript components in a partial. To support that I did a bit of research and found the following links:

Personally I ran into something somewhat similar on this stack question where javascript is included dynamically but doesn't get run. You can manually run javascript using a custom directive but it isn't extremely easy.

Bottom Line - I think the bottom line here is if you need to include scripts in a partial there are ways to do it but it is extra work and isn't supported terribly well.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top