Skip to content

Instantly share code, notes, and snippets.

@Hypercubed
Last active June 3, 2016 16:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hypercubed/356e5f9cb356bfdfa721 to your computer and use it in GitHub Desktop.
Save Hypercubed/356e5f9cb356bfdfa721 to your computer and use it in GitHub Desktop.
Use systemjs/plugin-text to import html directly to $routeProvider or $templateCache, works great with jspm bundle.
import somethingHTML from './something.html!text';
angular.module('myApp',[])
.directive('myDirective', function() {
return {
template: somethingHTML
}
});
import somethingHTML from 'components/something/something.html!text';
angular.module('myApp',[])
.run(function($templateCache) {
$templateCache.put('components/something/something.html', somethingHTML);
});
import somethingHTML from 'components/something/something.html!text';
angular.module('myApp',[])
.config(function($routeProvider) {
$routeProvider
.when('/something', {
template: somethingHTML,
})
});
@wz2b
Copy link

wz2b commented Nov 6, 2015

How does this work, when all three of these files seem to create module 'myApp? Seems like it should fail on the 2nd and 3rd telling you that module myApp already exists.

@forestjohnsonpeoplenet
Copy link

they are all different examples of the same thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment