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!
glyphicon-info-sign
is. There is no problem to have a dynamic link based onstudentInfo
in the popover template.href
value. Try building it up before you pass tohref
. Note that you may also need to use the$sce
service.