anchor tag in ui.bootstrap modal is not working

973 Views Asked by At

I am new to angular. I have create a modal using angular ui.bootstrap. I have an anchor tag with external link. If i click on anchor tag, the new window is not opening. any preventDefault is applied on modal ?

$uibModalInstance = $uibModal.open({
            animation: true,
            template: '<div class="modal-header "><h3 class="modal-title">{{modalTitle}}<a href="javascript:void(0);" class="icon icon-page_close_grey" ng-click="cancel()"></a></h3></div>' +
                '<div class="modal-body">' + data + '</div><div class="modal-footer"></div>',
            size: 'lg',
            backdrop:'static',
            controller: modalcontroller
        });

Here my data is contains a tag with href="http://www.google.com" , target="_blank". Can any one help out

1

There are 1 best solutions below

3
On

Try this way:

'<div class="modal-body" ng-non-bindable>' + data +
    '</div><div class="modal-footer"></div>'

Angular will ignore elements with ng-non-bindable attribute, so anchor tag will behave as plain html tag.