AngularJS具有相同模块名称的两个指令
发布时间:2020-12-17 09:15:27 所属栏目:安全 来源:网络整理
导读:是否可以创建具有相同模块名称的两个指令? 拥有这两个文件 angular.module('fabTemplate',[]) .directive('fabGallery',[function () {.... 和 angular.module('fabTemplate',[]) .directive('fabVideo',[function () {... 第二个指令将不被承认. fab-video
是否可以创建具有相同模块名称的两个指令?
拥有这两个文件 angular.module('fabTemplate',[]) .directive('fabGallery',[function () { .... 和 angular.module('fabTemplate',[]) .directive('fabVideo',[function () { ... 第二个指令将不被承认. <fab-video /> 不渲染任何东西.通过更改模块名称. AngularJS的documentation says的参数名称(模块“method”的第一个参数)
我想这应该工作,然后…:S
如果要检索模块,则必须仅使用angular.module()的第一个参数.
From the docs:
你的代码应该是这样的: //Module definition: angular.module('fabTemplate',[]); //Get the module and add the first directive: angular.module('fabTemplate').directive('fabGallery',function () {}); //Get the module and add the second directive: angular.module('fabTemplate').directive('fabVideo',function () {}); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |