问题描述
我采用了棱角分明的UI引导显示模式窗口。我想变成一个指令,将让我拉从服务器内容和模式或酥料饼显示它...
I'm using angular-ui bootstrap to show modal windows. I'd like to turn this into a directive that would let me pull content from the server and display it in a modal or popover…
例如:<一个A-信息框=模态的href =#/内容/一>将链接< / A>
应该得到的内容从href和拉入模式窗口。
For example: <a a-infobox="modal" href="#/content/one">A link</a>
should get the content from the href and pull it into a modal window.
我拉到一起plunkr:。第一个环节都有 A-信息框
属性。当我点击它没有对话框显示出来。在控制台中,你可以看到它被调用。
I pulled together a plunkr: http://plnkr.co/edit/cwtTHjMsW0knlsq2NNtg?p=preview. The first link has the a-infobox
attribute. When I click on it no dialog shows up. In the console you can see that it was called.
当我点击它是由一个控制器称为第二个链接,它会打开第二个对话框。后来,当我点击该模式的按钮,它会消失,从第一次点击该对话框是正确的后面。
When I click on the second link which is called from a controller, it opens the second dialog. Then when I click the button on that modal, it disappears and the dialog from the first click is right behind it.
我刚开始钻研指令和相信我失去了一些东西根本。
先谢谢了。
I'm just starting to dig into directives and am sure I'm missing something fundamental.Thanks in advance.
推荐答案
我找到了解决办法......看来这个模式需要应用这样的角度将处理它的下一个摘要。
I found a solution...it appears that the modal needs to be applied so angular will process it on the next digest.
一个简单的一行: $范围申请($ rootScope.dlg);
都是花了
A simple line: scope.$apply($rootScope.dlg);
is all it took.
该plunker进行了相应更新。
The plunker was updated accordingly.
这篇关于打开一个引导模式,在角1.2指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!