Mohammed Akdim
Mohammed Akdim

Reputation: 2401

How using "uib-tooltip-template" with ng-repeat of AngularJS?

How can using "uib-tooltip-template" with ng-repeat of AngularJS ? There is a methode to add templates dynamicly because I tried it but it does not work !!

<li ng-repeat="item in items" class="cursor-element">
  <a tooltip-trigger="'click'"
     tooltip-placement="left"
     uib-tooltip-template="'template1.html'"
     tooltip-is-open="item.isOpen"
     tooltip-class="customized">
  </a>
</li>

<script type="text/ng-template" id="template1.html">
  <div class="row action-menu">
  <h3>test </h3>
</script>
<script type="text/ng-template" id="template2.html">
  <div class="row action-menu">
  <h3>test </h3>
</script>
 .
 .
 .
<script type="text/ng-template" id="templateN.html">
  <div class="row action-menu">
  <h3>test </h3>
</script>

Upvotes: 1

Views: 1112

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136144

If you want to add template id dynamically based on $index/ some specific property from your item ojbect

uib-tooltip-template="'template'+ $index +'.html'"
//OR
uib-tooltip-template="'template'+ item.TypeId +'.html'"

Upvotes: 1

Related Questions