0

I'm trying to implement a popover to activate when a glyphicon is clicked. Inside the popover I want to show a link to go to a new page.

I'm on angular-ui version 0.13.4.

I found: Angularjs ui bootstrap - put html inside popover so I'm trying to do something similar.

My html looks like <i class="glyphicon glyphicon-info-sign" popover-html="displayLinkGoToWorkflowAssessment(studentInfo)" popover-title="In Progress"></i>

And in my controller:

$scope.displayLinkGoToWorkflowAssessment = function (studentInfo) { return '<a ng-href="/assessment/workflowAssessment/{{$routeParams.accountID}}/{{studentInfo.Student.StudentID}}/{{studentInfo.WorkflowAssessmentVersionID}}">Jody</a>'; }

The link appears but nothing happens when I click.

I've also tried:

$scope.displayLinkGoToWorkflowAssessment = function (studentInfo) { return '<a href="/assessment/workflowAssessment/" + $routeParams.accountID + "/" + studentInfo.Student.StudentID + "/" + studentInfo.WorkflowAssessmentVersionID">link</a>';

And I get the error: the sanitizer was unable to parse the following block of html <a href="/assessment/workflowAssessment/" + $routeParams.accountID + "/" + studentInfo.Student.StudentID + "/" + studentInfo.WorkflowAssessmentVersionID">link</a>

I'm not quite sure what I'm missing to get this working.

Thanks for any help!

James White
  • 535
  • 10
  • 24
  • Does [this answer](https://stackoverflow.com/questions/16722424/how-do-i-create-an-angularjs-ui-bootstrap-popover-with-html-content/32802558#32802558) helps? – Michel Oct 02 '15 at 16:23
  • Well, the link has to be dynamic. If the link is stored in a template, how do I pass variables to it? – James White Oct 02 '15 at 16:27
  • The popover has the same scope as the one where the `glyphicon-info-sign` is. There is no problem to have a dynamic link based on `studentInfo` in the popover template. – Michel Oct 02 '15 at 16:59
  • Your problem has nothing to do with the popover, per se, but rather your `href` value. Try building it up before you pass to `href`. Note that you may also need to use the `$sce` service. – icfantv Oct 06 '15 at 20:21

0 Answers0