javascript - Using add-hoc angular directive in an external html -


this should simple can't done right. have custom angular directives working fine, , i'm intended use in external (other domain/server/port) html.

first, included scripts working directives webapp:

<script      data-main="http://localhost:9000/vassets/javascripts/main.js"     src="http://localhost:9000/vassets/lib/requirejs/require.js"> </script> 

then tried use 1 of them in external html:

<div custom-directive attrib="abcd"></div> 

problem template associated directive cant loaded, since declared as:

templateurl: '/vassets/partials/customdirective.html' 

and of course can't found when external html loaded. there alse issues regarding cross site.

it clear i'm not including external directives (and importing source) correctly.

one thing can done in directives, instead of referencing external template, can place template inside directive itself. like:

template: '<div>template here</div>' 

now when export directive file new app have no worries in exporting template file well.

alternatively, can keep existing scenario , place template in location directive looking it.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -