javascript - Multiple angular directives referring to the same template -
i've found myself in situation have 2 isolate scope directives (each managing differentiated scope , dom state) referring single template.
.directive1... scope: {}, templateurl: 'template1', .directive2... scope: {}, templateurl: 'template1',
i'm used having 1-to-1 relationship between directives , templates, , model (2 directives - - 1 template) has me veering pattern.
is there reason shouldn't have multiple isolate scope directives referring same template?
is in violation of 'best practices' design pattern thought?
are there other design considerations should taking account here?
if directive1 , directive2 similar in form , function, don't see issue in reusing same template. although, if similar may mean should 1 directive parameters/options passed on scope?
i add need clear in naming of directives/templates involved in 2-to-1 situation similar, ex: 'apple' directive , 'orange' directive both use 'fruit' template, similar class inheritance pattern.
Comments
Post a Comment