javascript - 如何在 Ion Modal 中从调用页面获取数据

标签 javascript meteor ionic-framework meteor-blaze meteoric

在我的一个页面上(其中有

<button class="button button-small button-balanced" data-ion-modal="reviewPopup">
    leave review
</button>

在该模态中,我有一个表单,当我单击按钮时,应该将数据从模态和模板 a 中的模板发送到服务器。我可以很好地从模态中的表单获取数据,但无法从调用页面访问任何数据(特别是我需要 _id)。调用 Template.parentData 仅返回 null。

最佳答案

您可以从按钮事件触发模态,而不是使用 data-ion-modal="reviewPopup" 从模板触发模态 -

Template.templateName.events({
  'click #review-popup': function() {
     //capture data from parent template first
     //....
     var parentDataContext = {some data}

     IonModal.open("reviewPopup", parentDataContext);
  }
})

模式打开后,可以使用模式助手中的 this 访问父数据。

关于javascript - 如何在 Ion Modal 中从调用页面获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32878278/

相关文章:

javascript - 页面刷新后自动调用Ajax

javascript - 在 AngularJS 1.4 中使用服务器端 JSON 数组对象作为登录详细信息

javascript - 动态添加的 HTML 上的 Hammer.js 事件

angularjs - ionic 3 : ng-change doesn't work

angular - Ionic 3 如何确保在加载 View 之前获取数据库数据

cordova - 我无法将 app-debug.apk 安装到我的手机中

javascript - 使用 TypeScript 泛型定义 Factory 方法的返回类型

javascript - 如何使用 IronRouter 和 Meteor 将模板渲染为模板

javascript - meteor : to get and show github username and email

node.js - nodejs googleapis,authClient.request 不是函数