后来 Safari 的某次更新修复了这个问题,前提是 button
需要加上 type="submit"
虽然我也不是很清楚……
但是在网上发现了类似的问题,希望可以有些帮助。
问题:Modal window in AngularJS does not open on first click
回答内容:
The issue does appear to be due to the separate file specified in the templateUrl not yet having been downloaded when the first click happens and I have now been able to work out a solution by adding the following line into the index.html file:
<div ng-include="'mymodalcontent.html'"></div>
This directive adds a reference to the file which loads the templateUrl so that when the button is clicked the first time the modal window will appear as expected.
Please note the value in the ng-include attribute has to have single quotes in order to work as detailed in the documentation for the ng-include directive. This detail is mentioned in the section named arguments and advises:
If the source is a string constant, make sure you wrap it in quotes
I have updated the plunkr code to include the fix.
The only downside to this is the original purpose behind moving the modal window contents into a separate file was to only download the contents if the user clicked the button thus saving bandwidth for users accessing the site on a mobile device.
原帖地址:https://stackoverflow.com/questions/22245107/modal-window-in-angularjs-does-not-open-on-first-click
你这也没有点击事件啊?
刚过这个坑 应该是bug 我升级在angular 7就没有这个问题