Angularjs Yeoman角度生成器和引导模板
因此,我有一个应用程序,我已经用yo-angular构建了它,所有这些都已经运行了一段时间。 我已经覆盖了一些引导模板(特别是日期选择器),并且在创建templateCache时更新了grunt任务以包含以下文件:Angularjs Yeoman角度生成器和引导模板,angularjs,gruntjs,Angularjs,Gruntjs,因此,我有一个应用程序,我已经用yo-angular构建了它,所有这些都已经运行了一段时间。 我已经覆盖了一些引导模板(特别是日期选择器),并且在创建templateCache时更新了grunt任务以包含以下文件: ngtemplates: { dist: { options: { module: 'sapphire', htmlmin: '<%= htmlmin.dist.options %>',
ngtemplates: {
dist: {
options: {
module: 'sapphire',
htmlmin: '<%= htmlmin.dist.options %>',
usemin: 'scripts/scripts.js'
},
cwd: '<%= yeoman.app %>',
src: [
'app/**/*.html',
'uib/**/*.html'
],
dest: '.tmp/templateCache.js'
}
},
ngtemplates:{
地区:{
选项:{
模块:“蓝宝石”,
htmlmin:“”,
usemin:'scripts/scripts.js'
},
cwd:“”,
src:[
“app/***.html”,
“uib/***.html”
],
dest:'.tmp/templateCache.js'
}
},
问题是在本地测试时。它不使用新模板,这很烦人。
我一直在使用injector将我的项目文件注入我的index.html,因此我创建了以下内容:
html: {
options: {
transform: function (filePath) {
return '<script type="text/ng-template" src="\'' + filePath.replace('/src/', '') + '\'"></script>';
}
},
files: {
'<%= yeoman.app %>/index.html': [
'<%= yeoman.app %>/uib/**/*.html'
]
}
},
html:{
选项:{
转换:函数(文件路径){
返回“”;
}
},
档案:{
“/index.html”:[
“/uib/***.html”
]
}
},
它将我的模板添加到index.html的底部,如下所示:
<!-- injector:html -->
<script type="text/ng-template" src="'uib/template/datepicker/datepicker.html'"></script>
<script type="text/ng-template" src="'uib/template/datepicker/day.html'"></script>
<script type="text/ng-template" src="'uib/template/datepicker/month.html'"></script>
<script type="text/ng-template" src="'uib/template/datepicker/year.html'"></script>
<script type="text/ng-template" src="'uib/template/timepicker/timepicker.html'"></script>
<script type="text/ng-template" src="'uib/template/typeahead/typeahead-account-match.html'"></script>
<script type="text/ng-template" src="'uib/template/typeahead/typeahead-complaint.html'"></script>
<script type="text/ng-template" src="'uib/template/typeahead/typeahead-customer-services.html'"></script>
<script type="text/ng-template" src="'uib/template/typeahead/typeahead-match.html'"></script>
<script type="text/ng-template" src="'uib/template/typeahead/typeahead-order-match.html'"></script>
<script type="text/ng-template" src="'uib/template/typeahead/typeahead-product-match.html'"></script>
<script type="text/ng-template" src="'uib/template/typeahead/typeahead-stock-match.html'"></script>
<script type="text/ng-template" src="'uib/template/typeahead/typeahead-user-match.html'"></script>
<!-- endinjector -->
这些模板放在JavaScript文件下。
我在上面试过了,但还是不起作用。有人知道为什么吗?当你说“这些模板放在JavaScript文件下”时,有点不清楚。。。。这是否意味着
标记(即通过注射器任务更改src
路径的标记)放在
标记之后,该标记已存在于目标.html
中?如果是,则
的src
属性是否也会通过另一个注入器任务或其他grunt任务进行更改?否,我的意思是它被放在应用程序脚本文件下,因此在