【问题标题】:Migrating UI-Bootstrap modal to component based将 UI-Bootstrap 模式迁移到基于组件的
【发布时间】:2017-09-23 18:43:11
【问题描述】:

我正在研究 UI-Router 和 UI-Bootstrap modal 并且遇到了问题。 UI-Bootstrap 教程中的cloned one 工作正常,但是当迁移到component based version 时,我遇到了问题:它不显示模式窗口。任何人都可以帮助找出问题所在。

【问题讨论】:

    标签: angularjs angular-ui-router angular-ui-bootstrap


    【解决方案1】:

    你应该重构函数声明如下:

    来自var modalDemoCtrl = function($scope, $uibModal, $log, $document)
    function modalDemoCtrl($scope, $uibModal, $log, $document)

    来自var ModalInstanceCtrl = function($uibModalInstance)
    function ModalInstanceCtrl()

    这样你就可以引用文件中之前代码中的函数了。

    另外,您不应将$uibModalInstance 传递给ModalInstanceCtrl

    【讨论】:

    • 非常感谢@lzagkaretos 修改后的工作(我仍在试图理解为什么)。抱歉,我是 15 岁以下的新人,不能投票给你。
    • @Oops,您可以接受我的回答,并在第一时间回来投票!谢谢。
    猜你喜欢
    • 2023-03-30
    • 2018-07-26
    • 2021-10-20
    • 2020-08-18
    • 2016-12-31
    • 1970-01-01
    • 2020-10-07
    • 2022-01-04
    • 2019-02-14
    相关资源
    最近更新 更多