Skip to content

Commit

Permalink
feat(tooltip): use expression to fix usage with $sce
Browse files Browse the repository at this point in the history
Allows for trusted resource URLs through Strict Contextual Escaping ($sce).
If the an interpolated expression is used instead, then the benefits of SCE is
lost.

Fixes angular-ui#3558
  • Loading branch information
chrisirhc committed Apr 19, 2015
1 parent 82cb637 commit 3d023bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/tooltip/docs/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<a href="#" tooltip-animation="false" tooltip="I don't fade. :-(">fading</a>
at elementum eu, facilisis sed odio morbi quis commodo odio. In cursus
<a href="#" tooltip-popup-delay='1000' tooltip='appears with delay'>delayed</a> turpis massa tincidunt dui ut.
<a href="#" tooltip-template="myTooltipTemplate.html">Custom template</a>
<a href="#" tooltip-template="'myTooltipTemplate.html'">Custom template</a>
nunc sed velit dignissim sodales ut eu sem integer vitae. Turpis egestas
</p>

Expand Down
2 changes: 1 addition & 1 deletion src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ function ($animate , $sce , $compile , $templateRequest) {
return {
restrict: 'EA',
replace: true,
scope: { title: '@', content: '@', placement: '@', animation: '&', isOpen: '&',
scope: { title: '@', contentExp: '&', placement: '@', animation: '&', isOpen: '&',
originScope: '&' },
templateUrl: 'template/tooltip/tooltip-template-popup.html'
};
Expand Down
2 changes: 1 addition & 1 deletion template/tooltip/tooltip-template-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
ng-class="{ in: isOpen() }">
<div class="tooltip-arrow"></div>
<div class="tooltip-inner"
tooltip-template-transclude="content"
tooltip-template-transclude="contentExp()"
tooltip-template-transclude-scope="originScope()"></div>
</div>

0 comments on commit 3d023bc

Please sign in to comment.