【问题标题】:ionic 2 Passing Data From ion-item-optionsionic 2 从 ion-item-options 传递数据
【发布时间】:2017-07-16 10:57:41
【问题描述】:

如何将项目数据从主页中的 ion-item-options 按钮发送到地图页面。

我要发送此商品数据{{info.map}}

Home.html

<ion-item-sliding *ngFor="let info of infos">

      <ion-item>

        {{info.title}} 
         {{info.map}} 

      </ion-item>

    <ion-item-options>
           <button ion-button icon-only color="light" (click)="Map()">
              <ion-icon name="map"></ion-icon>
            </button>

我的 home.html 中有这段代码

想寄到这里 ma​​p.ts

let latLng = new google.maps.LatLng(**HERE**);

【问题讨论】:

  • Map() 函数在做什么?您正在导航到 map.ts 吗?
  • 是导航到地图页面

标签: ionic-framework ionic2


【解决方案1】:

您可以在click 事件中将数据作为参数发送。

 <button ion-button icon-only color="light" (click)="Map(info.map)">
     <ion-icon name="map"></ion-icon>
 </button>

Map()定义为Map(data:any)并通过NavController将对象作为参数发送。

Map(data:any){
  this.nav.push(MapPage,{FirstParam:data});
}

【讨论】:

  • 抱歉让你忙了,我需要写什么Map(data:any){ this.nav.push(MapPage,{'here' }); } 当我尝试使用{FirstParam: info.map} 时,它看起来是空的
  • 对迟到的回复感到抱歉..显然我们在不同的时区。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-02
  • 2021-08-05
  • 2017-08-05
  • 2018-06-09
  • 2017-11-09
  • 2017-12-14
相关资源
最近更新 更多