javascript - ui-calendar 首先隐藏然后显示时的问题

标签 javascript angularjs calendar angular-ui

当您的日历先隐藏然后显示时,我遇到了 ui-calendar 的一个奇怪问题。 在 Github 上,遇到了类似的问题,但使用了选项卡(我不使用):https://github.com/angular-ui/ui-calendar/issues/28

我编辑了一个 JsFiddle 来明确这个问题: http://jsfiddle.net/fECuY/20/

<div ng-show="test">
      <div ng-controller="MainCtrl" ui-calendar="calendar" config="uiconfig.calendar" ng-model="events"></div>
</div>

如果您单击该按钮,应显示第二个日历,但仅呈现其“标题”。如果我们尝试在链接到 ng-show 属性的变量发生更改时呈现日历,则 ng-show 尚未更新,因此即使使用 DOM 操作,也无法在此元素上调用 fullCalendar() .

那么当我想要显示我的日历时,如何才能正确呈现它呢?

提前致谢。

最佳答案

问题在于 ng-show 的工作方式。它本质上是使用 display: none 来隐藏元素。这会导致日历显示方式出现问题。解决方案是改用ng-if,它会在为真时生成日历。请参阅 GitHub 问题中的评论 here .

关于javascript - ui-calendar 首先隐藏然后显示时的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23893205/

相关文章:

javascript - html 标签在正则表达式中不匹配

javascript - 使用对象内的对象对数组进行排序

javascript - AngularJS — Promise 包含旧信息

javascript - Bootstrap 日历的某些功能不起作用

javascript - 在 ASP.NET MVC 中使用 ModelBinding 时,我可以选择要将属性绑定(bind)到哪个元素吗?

javascript - chrome 更改 cookie 路径

javascript - Angular 中的按值复制无法正常工作

javascript - 无法从我的 javascript 函数获取值

swift - ubuntu Swift 中日历功能的替代方案?

ruby - 无法通过 ruby​​ API 插入新的 Google 日历事件,提醒错误