angularjs - How do I include one angular template in another so that bootstrap classes still work? -
i have directive uses 3 different templates:
http://jsfiddle.net/edwardtanguay/plrkya7r/4
these templates each have panel , want them include header template same each of them, this:
<script type="text/ng-template" id="itemmenutemplateundefined"> <div class = "panel panel-default" > <div ng-include="'itemmenutemplatepanelheading'"></div> <div class="panel-body"> <div>age: {{item.age}}</div> </div > </div> </script>
the included template looks this:
<script type="text/ng-template" id="itemmenutemplatepanelheading"> <div class="panel-heading">{{item.firstname}} <b>{{item.lastname}}</b> (problem included no color)</div> </script>
the problem although includes scope variable values , html, doesn't seem have same html structure causes e.g. panel header color not display.
how can example work has same html structure without ng-include bootstrap continues work?
the problem bootstrap css specific in targeting panel heading direct child of panel using selectors .panel-warning>.panel-heading
.
the <div>
ng-include
breaks child relationship making it
<div class="panel"> <div ng-include> <div class="panel-heading>
some possible choices:
add appropriate classes
ng-include
divcopy css rules , replace
>
in selector spaceuse own directive instead of ng-include , within options set
replace:true
Comments
Post a Comment