如何在Angular.js中为uikit组件创建自定义指令?

时间:2015-03-23 01:35:16

标签: javascript angularjs

我正在尝试将angular.jsuikit进行整合。我知道我有一个正确的轨道,因为我得到弹出模式,但不幸的是只有点击导航中的页面链接!?有人可以解释为什么会这样吗?

我的指示:

app.directive('animationOverlay', function() {
    return {
        restrict: 'A',
        link: link
    };


    function link(scope, element, attrs) {

        var modal = $.UIkit.modal(".modalFunc");

        if (modal.isActive()) {
            modal.hide();
        } else {
            modal.show();
        }

    }
});

我的HTML:

<div animation-overlay id="modal-1" class="uk-modal modalFunc">
    <div class="uk-modal-dialog uk-modal-dialog-lightbox">
      <a href="" class="uk-modal-close uk-close uk-close-alt"></a>
        <img width="600" height="400" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjQsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkViZW5lXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iNjAwcHgiIGhlaWdodD0iNDAwcHgiIHZpZXdCb3g9IjAgMCA2MDAgNDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA2MDAgNDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxyZWN0IGZpbGw9IiNGNUY1RjUiIHdpZHRo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