将数据从一个页面传递到另一个页面(来源:来自'Ionic-Feed'项目)

typescript
阅读 43 收藏 0 点赞 0 评论 0

detail.ts
...
import { NavController, NavParams } from 'ionic-angular'; // <-- NavParams needed to pass data between pages
...
...

@Component({
  selector: 'page-detail',
  templateUrl: 'detail.html',
})
export class DetailPage {

  // Get data passed from HomePage
  key: string = this.navParams.get('$key');
  title: string = this.navParams.get('title');
  body: string = this.navParams.get('body');
  timestamp: string = this.navParams.get('timestamp');
  authorId: string = this.navParams.get('authorId');
  authorName: string = this.navParams.get('authorName');
  authorEmail: string = this.navParams.get('authorEmail');
  authorPhoto: string = this.navParams.get('authorPhoto');
  
  constructor(public navCtrl: NavController, public navParams: NavParams) {
    // Listen for new data on this subject
    ...
    ...
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号