加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

AngularJS使用templateHtml的路径作为模块名称

发布时间:2020-12-17 17:10:26 所属栏目:安全 来源:网络整理
导读:我注意到AngularJS UI Bootstrap对模板使用以下方法: angular.module("uib/template/progressbar/bar.html",[]).run(["$templateCache",function($templateCache) { $templateCache.put("uib/template/progressbar/bar.html" } 所以我认为这是一个非常好的
我注意到AngularJS UI Bootstrap对模板使用以下方法:

angular.module("uib/template/progressbar/bar.html",[]).run(["$templateCache",function($templateCache) {
  $templateCache.put("uib/template/progressbar/bar.html" }

所以我认为这是一个非常好的解决方案但是为每个模板创建模块的原因是什么,例如angular.module(“uib / template / progressbar / bar.html”或angular.module(“uib / template / progressbar / progress.html”) “等等

它会给我们带来什么好处?

解决方法

分别为每个模板设置一个模块将导致代码的正确分离.每个模块都将为每个模板添加代码,并防止用户混合代码.一个普遍的规则是,一个功能或实体应该只履行自己的职责而不是那个职责.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读