【问题标题】:How can params be passed through Ionic Modal?参数如何通过 Ionic Modal 传递?
【发布时间】:2016-05-27 05:23:36
【问题描述】:

就像我们通过模态传递参数一样,正如下面resolve 示例中所做的那样:

$scope.someFunction = function(item) {
  item.root = true;
  modalInstance = $uibModal.open({
    animation: true,
    controller: 'newController',
    templateUrl: '/views/modals/somePage.html',
    resolve: {
      params: function () {
        return { item: item};
      }
    }
  });
};

我不确定如何在 ionicModal 中传递参数??

$ionicModal.fromTemplateUrl('main/templates/viewPage.html', {
        scope: $scope,
        animation: 'slide-in-up'
        }).then(function(modal) {
          $scope.modal = modal;
      });

上面的 ionicModal 代码中是否有与animation 一起使用的选项?

非常感谢您的帮助!

【问题讨论】:

    标签: javascript angularjs ionic-framework modal-dialog params


    【解决方案1】:

    您不需要传递任何数据。您的父范围已作为

    传递
    scope : $scope
    

    所以你可以把你的数据作为scope.item

    请关注此网址 https://forum.ionicframework.com/t/how-to-pass-data-from-parent-controller-to-ionicmodal/2030/2

    【讨论】:

    • 谢谢。我会检查
    • 非常感谢。
    猜你喜欢
    • 2017-07-30
    • 2019-10-05
    • 2018-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-04
    相关资源
    最近更新 更多