Javascript gulp angular templatecache模块不可用
我正在使用Javascript gulp angular templatecache模块不可用,javascript,angularjs,gulp,angular-templatecache,Javascript,Angularjs,Gulp,Angular Templatecache,我正在使用大口吞下角度模板。 我的任务是创建一个名为templates的模块,我将其作为依赖项添加到我的app模块中: 配置: templateCache: { file: 'tempaltes.js', options: { module: 'templates', standalone: true, root: 'app/'
大口吞下角度模板
。
我的任务是创建一个名为templates
的模块,我将其作为依赖项添加到我的app
模块中:
配置:
templateCache: {
file: 'tempaltes.js',
options: {
module: 'templates',
standalone: true,
root: 'app/'
}
}
应用程序模块:
var App = angular.module('app', [
'templates']);
吞咽任务:
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]模块“模板”不可用!您要么拼错了模块名,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数
我试图使templatescache也不是独立的,并删除依赖项,但没有成功。。。
我该怎么办???在模块app
定义之后,您似乎正在加载template.js。您可以在angular应用程序
文件之前加载该文件
或者,不要定义独立模块
配置
角度
在模块app
定义之后,似乎正在加载template.js。您可以在angular应用程序
文件之前加载该文件
或者,不要定义独立模块
配置
角度
文件的顺序是什么?
file:'tempaltes.js'
我在询问脚本标记的顺序文件的顺序是什么?file:'tempaltes.js'
我在询问脚本标记的顺序我试过了,我得到的模块“模板”在我的index.html中不可用我在注入我的应用程序js后注入templates.js。我刚刚尝试过,我得到的模块“模板”在我的index.html中不可用我在注入我的应用程序js后注入templates.js。
templateCache: {
file: 'tempaltes.js',
options: {
module: 'templates',
standalone: false,
root: 'app/'
}
}
//Define the module
angular.module('templates', []);
var App = angular.module('app', ['templates']);