Last active
June 3, 2016 16:01
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import somethingHTML from './something.html!text'; | |
angular.module('myApp',[]) | |
.directive('myDirective', function() { | |
return { | |
template: somethingHTML | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import somethingHTML from 'components/something/something.html!text'; | |
angular.module('myApp',[]) | |
.run(function($templateCache) { | |
$templateCache.put('components/something/something.html', somethingHTML); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import somethingHTML from 'components/something/something.html!text'; | |
angular.module('myApp',[]) | |
.config(function($routeProvider) { | |
$routeProvider | |
.when('/something', { | |
template: somethingHTML, | |
}) | |
}); |
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
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.