【发布时间】:2016-09-13 18:09:24
【问题描述】:
我的应用程序中有一个模式,当前使用 bootsrap 打开:
<div class="modal full-page fade" tabindex="-1" role="dialog" id="fullpageModal">
<div class="full-page-content">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<iframe src="http://www.example.com/id/1"></iframe>
在我的 HTML 中,我有一个附加到函数的按钮:
<button (click)="initPlay(2)" data-toggle="modal" data-target="#fullpageModal" >PLAY</button>
目前bootstrap打开modal,Angular处理点击。
需要做的是:
- 用户点击按钮
- iFrame URL src 根据点击的按钮更新
- 使模态可见。
我认为我需要做的是:
- 从引导程序中移除模态框的开口并将其交给 Angular2
- 在按钮点击功能更新 iframe src
- 该函数然后打开模态(或将其交还给 Bootstrap?)
我的问题:
更新 iframe src 的最佳方法是什么?也许要包含一个变量:{{iframeSrc}} 并在点击后更新它?
处理模态打开的最佳方法是什么?
谢谢!
【问题讨论】:
-
在 bootstrap 的 js 中使用 Angular 可能会一团糟。你可以看看angular-ui.github.io/bootstrap,因为他们已经完成了繁重的工作。
标签: javascript jquery twitter-bootstrap iframe angular