在textAngular Editor中使用angular bootstrap模态进行插入链接

时间:2014-11-24 07:29:18

标签: javascript angularjs angular-ui-bootstrap

我希望使用angularjs bootstrap模式进行插入链接,因此在textAngularSetup.js文件中包含$ modal作为依赖项,并在insertLink动作函数中使用它:

taRegisterTool('insertLink',{
    tooltiptext: taTranslations.insertLink.tooltip,
    iconclass: 'icon-link',
    action: function(){
        var that=this;
        var result={
            texttodisplay:'ahmad',
            webaddress:'',
            isOk:''
        }
        var insertLinkmodalScope=$rootScope.$new();
        insertLinkmodalScope.modalInstance=$modal.open({
            templateUrl: 'editor/views/insertlink.client.view.html',
            controller: 'EditorController',
            size: 'sm',
            scope:insertLinkmodalScope,
            resolve:{
                        //pass result to modal
                link:function(){
                    return result;
                }
            }
        });
        //define result modal , when user complete result information 
        insertLinkmodalScope.modalInstance.result.then(function(result){
            if (result.isOk) {
                return that.$editor().wrapSelection('createLink', result.webaddress, true);
            }
        });

    },
   activeState: ....,
   onElementSelect: ....
});

当我在chrome中调试代码时,找出已执行的命令但在HTML编辑器中没有影响。 是从bootstrap模态用于嵌入链接的任何方法吗?

1 个答案:

答案 0 :(得分:0)

由于这是在两个地方提出的,我在这里链接到github问题的答案:https://github.com/fraywing/textAngular/issues/419