我正在使用Angular指令进行模态框
这是我的标记:
<li><a ng-attr-title="{{::'Share'}}"
href="" class="shareButton" bh-model-ctrl="ShareArticleCtrl"
bh-template-html="shareArticleTemplate.html"
bh-alternate-id="items.alternate_id"
bh-title="items.bookmark_title" bh-url="items.bookmark_url"
bh-share-article></a></li>
和指令代码就像
app.directive("bhShareArticle", ["$modal", "$window", function ($modal, $window) {
return {
restrict: 'A',
scope: {
alternateId: '=bhAlternateId',
bookmarkTitle: '=bhTitle',
bookmarkUrl: '=bhUrl'
},
link: function (scope, element, attrs) {
element.click(function (event) {
event.stopPropagation();
var modalInstance = $modal.open({
templateUrl: attrs.bhTemplateHtml,
controller: attrs.bhModelCtrl,
size: 'sm',
resolve: {
bookmark: function () {
return {
alternateId: scope.alternateId,
bookmarkTitle: scope.bookmarkTitle,
bookmarkUrl: scope.bookmarkUrl
};
}
}
});
modalInstance.result.then(function () {
if (attrs.redirect == "true") {
$window.location.href = '/user/dashboard';
}
}, function () {
//$log.info('Modal dismissed at: ' + new Date());
});
});
scope.$on('$destroy', function () {
element.off('click');
});
}
};
}]);
哪个工作正常。现在我们要更改为 popover 。
我们可以轻松做到吗?
由于