如何通过Ionic Modal传递参数?

时间:2016-05-27 05:23:36

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

就像我们通过模态传递参数一样,如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中传递params?

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

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

非常感谢帮助!

1 个答案:

答案 0 :(得分:1)

您无需传递任何数据。您的父作用域已作为

传递
scope : $scope

因此,您可以将数据作为scope.item

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

相关问题