问题
Hi I am using the gulp plugin, to create template of all my partials and later merge it with application js script and minified.
var partials: ['app/**/*.html', '!app/index.html', '!app/bower_components/**/*.html'],
gulp.src(partials)
.pipe(plugins.angularTemplatecache("templates.js", {module: "mainApp", root: "app/"}));
All .html load properly but when I try to specify html as part of some dialog box plugin inside some controller (I am using ng-material) it throws 404. ex -
$mdDialog.show({
controller: 'entityGridCtrl',
templateUrl: 'user/partials/entityGrid.html'
});
回答1:
In your gulp task, the root:
path must match how your reference the html. So, change root: "app/"
to root: "user/partials"
. (Or vice-versa)
来源:https://stackoverflow.com/questions/29399453/gulp-templatecache-and-using-html-url-for-dialog-box