简体   繁体   English

语义UI模式未定义

[英]Semantic UI Modal Undefined

I'm having trouble getting semantic-ui's modal module to work in my angularJS controller. 我在使用semantic-ui的模态模块在angularJS控制器中工作时遇到了麻烦。 When I call 我打电话的时候

$(".ui.modal").modal()

I'm getting the following error. 我收到以下错误。

TypeError: undefined is not a function at l.$scope.showAddBeacon (*js/controllers.js:320:20) at hb.functionCall (*lib/angular/angular.min.js:198:426) at Cc.(anonymous function).compile.d.on.f (*lib/angular/angular.min.js:215:74) at l.$get.l.$eval (*lib/angular/angular.min.js:126:193) at l.$get.l.$apply (*lib/angular/angular.min.js:126:419) at HTMLDivElement. TypeError:undefined不是l。$ scope.showAddBeacon(* js / controllers.js:320:20)在Cc的hb.functionCall(* lib / angular / angular.min.js:198:426)的函数。(匿名函数).compile.d.on.f(* lib / angular / angular.min.js:215:74)at l。$ get.l. $ eval(* lib / angular / angular.min.js:126 :193)at l。$ get.l. $ apply(* lib / angular / angular.min.js:126:419)at HTMLDivElement。 (*lib/angular/angular.min.js:215:126) at HTMLDivElement.n.event.dispatch (*lib/jquery/dist/jquery.min.js:3:6444) at HTMLDivElement.n.event.add.r.handle (*lib/jquery/dist/jquery.min.js:3:3219) HTMLDivElement.n.event.add上的HTMLDivElement.n.event.dispatch(* lib / jquery / dist / jquery.min.js:3:6444)中的(* lib / angular / angular.min.js:215:126) .r.handle(* lib / jquery / dist / jquery.min.js:3:3219)

The semantic module is installed and the modal is hidden by default as I would expect. 安装语义模块,默认情况下隐藏模态,正如我所料。 If I call the following it works fine: 如果我调用以下内容它可以正常工作:

$(".ui.modal").show() $( “ui.modal”)。节目()

I am able to achieve this requirement with $(".ui.modal").modal('show') instead of $(".ui.modal").modal() . 我可以用$(".ui.modal").modal('show')代替$(".ui.modal").modal()来实现这个要求。 Semantic UI modal function expects at least one argument in it to determine the status of the modal (show, hide, setting configuration, etc.). 语义UI模态函数期望其中至少有一个参数来确定模态的状态(显示,隐藏,设置配置等​​)。

Modal function with no argument is used to initialize a modal. 不带参数的模态函数用于初始化模态。 On initialization, a modal's current size will be cached, and the element will be detached from the DOM and moved inside a dimmer. 在初始化时,模式的当前大小将被缓存,元素将从DOM分离并移动到调光器内。

Reference: http://semantic-ui.com/modules/modal.html#/usage 参考: http//semantic-ui.com/modules/modal.html#/usage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM