popover的角度模式服务



我对模式框使用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

我们能轻松做到吗?

感谢

使用https://angular-ui.github.io/bootstrap/#/popover.我认为你只需要在主控制器中进行逻辑运算。