【发布时间】:2017-04-08 19:00:30
【问题描述】:
我正在使用gulp-angular-templacache。
我的任务是创建一个名为 templates 的模块,并将其作为依赖项添加到我的 app 模块中:
配置:
templateCache: {
file: 'tempaltes.js',
options: {
module: 'templates',
standalone: true,
root: 'app/'
}
}
应用模块:
var App = angular.module('app', [
'templates']);
Gulp 任务:
gulp.task('templatecache', ['clean-code'], function() {
log('Creating AngularJS $templateCache');
return gulp
.src(config.htmltemplates)
.pipe($.minifyHtml({empty: true}))
.pipe($.angularTemplatecache(
config.templateCache.file,
config.templateCache.options
))
.pipe(gulp.dest(config.temp));
});
但是,当我尝试运行它时,我总是收到该错误消息:
未捕获的错误:[$injector:nomod] 模块“模板”不可用!您要么拼错了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。
我试图使模板缓存也不是独立的并删除依赖项但没有成功...... 我该怎么办??
【问题讨论】:
-
文件的顺序是什么?
-
file: 'tempaltes.js' -
我在问脚本标签的顺序
标签: javascript angularjs gulp angular-templatecache