我试图激活我的模态,但它不起作用。我做错了什么?
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指令来调用函数来激活模态。谢谢!
答案 0 :(得分:1)
我找到了解决方案。我错过了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');
};