Gulp构建后加载的模板URL错误。我希望模板URL应该是$ templateCache.put('scripts / app / cinemasList / cinemasList.html'),但实际是$ templateCache.put('scripts / cinemasList / cinemasList.html')
gulp.task('ngtemplate', function() {
return gulp.src(config.srcTemplates)
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe($.ngHtml2js({
template: " $templateCache.put('<%= template.url %>',\n '<%= template.prettyEscapedContent %>');",
prefix: 'scripts/'
}))
.pipe($.concat('templates.js'))
.pipe($.tap(function(file, t) {
file.contents = Buffer.concat([
new Buffer("(function(module) {\n" +
"try {\n" +
" module = angular.module('myApp');\n" +
"} catch (e) {\n" +
// " module = angular.module('myApp', []);\n" +
"}\n" +
"module.run(['$templateCache', function($templateCache) {\n"),
file.contents,
new Buffer("\n}]);\n" +
"})();\n")
]);
}))
.pipe(gulp.dest(config.scripts + 'templates'));
});