gulp模板缓存并使用html URL作为对话框 [英] gulp templatecache and using html URL for Dialog box

查看:179
本文介绍了gulp模板缓存并使用html URL作为对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在使用gulp插件来创建我所有分支的模板,然后将其与应用程序js脚本合并并缩小。

  var partials:['app / ** / *。html','!app / index.html','! (templates.js,{module:mainApp); ,root:app /})); 

所有.html加载正确,但是当我尝试指定html作为一些对话框插件的一部分时控制器(我正在使用ng-material)它会抛出404. ex -

  $ mdDialog.show({
controller :'entityGridCtrl',
templateUrl:'user / partials / entityGrid.html'
});


解决方案

在您的gulp任务中, root:路径必须匹配你引用html的方式。因此,将 root:app /更改为 root:user / partials(反之亦然)


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'
            });

解决方案

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)

这篇关于gulp模板缓存并使用html URL作为对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆