0
I’m having a problem returning a value using the angular-ui-bootstrap. I have a function to return the result of each tooltip dynamically in a table the problem is that whenever I return the $sce.trustAshtml of a function it simply doesn’t work.
<head lang="en">
<title>uib-tooltip-html test</title>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.js"></script>
<script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.14.3.js"></script>
<script>
var app = angular.module("test", ['ui.bootstrap']).config(function($sceProvider) {
$sceProvider.enabled(false);
});
app.controller("testController", function($scope, $http, $interval, $sce) {
$scope.text = $sce.trustAsHtml('<div>Some text</div>');
$scope.text1 = function teste(){
var text = $sce.trustAsHtml('<div>Some text</div>');
return text;
};
});
</script>
</head>
<body>
<div ng-app="test" ng-controller="testController">
<p style="margin-top: 5em;" uib-tooltip-html="text" >
A Thing With an HTML Tooltip
</p>
<p style="margin-top: 5em;" uib-tooltip-html="text1" >
A Thing With an HTML Tooltip
</p>
<p style="margin-top: 5em;" uib-tooltip="text1" >
A Thing With a Tooltip without html
</p>
</div>
Have you tried that:
uib-tooltip-html="text1()"
?– DiegoAugusto
I’m using more get error
"Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
– Johnny Brito
I edited this example that you posted and it worked, is not forgetting anything?
– DiegoAugusto
The problem was my config that as it was in separate documents it did not set $sceProvider, so it worked on jsFiddle and the system did not work
– Johnny Brito