gpt4 book ai didi

javascript - Angularjs - 模态弹出窗口

转载 作者:行者123 更新时间:2023-12-03 05:04:01 25 4
gpt4 key购买 nike

我正在尝试激活我的模式,但它不起作用。我做错了什么?

.html

<div class="column is-narrow topIcons">
<div class="photo topIconsHover" ng-click="$ctrl.checked()">
<figure class="image is-128x128">
<img ng-src="{{a.imageSrc}}">
</figure>
</div>
</div>
</div>

<div class="modal">
<div class="modal-background"></div>
<div class="modal-content" ng-repeat="a in $ctrl.f">
<p class="image is-4by3">
<img ng-src="{{a.imageSrc}}">
</p>
</div>
<button class="modal-close"></button>
</div>

.js

vm.checked = function() {
console.log("Here!");
$('#myModal').modal('is-active');

};

我想使用 ng-clik 指令来调用将激活模式的函数。谢谢!

最佳答案

我找到了解决方案。我缺少 id="myModal"并且我改变了.js 文件

.html

<div class="modal" **id="myModal"**>
<div class="modal-background"></div>
<div class="modal-content" ng-repeat="a in $ctrl.f">
<p class="image is-4by3">
<img ng-src="{{a.imageSrc}}">
</p>
</div>
<button class="modal-close"></button>
</div>

对此:

vm.checked = function() {
console.log("Here!");
$('#myModal').addClass('is-active');

};

关于javascript - Angularjs - 模态弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42090968/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com