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 div

  • copy css rules , replace > in selector space

  • use own directive instead of ng-include , within options set replace:true


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

html - Why is a table with width of 75% wider than three tables which total 99%? -