2017-08-11 96 views
1

我在导航到产品页时出现错误,我正在使用NavParams。这里是我的代码:错误:没有NavParams的提供商

import { Component } from '@angular/core'; 
import { NavController, NavParams, AlertController, ModalController } from 'ionic-angular'; 

@Component({ 
    selector: 'page-product', 
    templateUrl: 'product.html' 
}) 
export class ProductPage { 
    data: any;  
    constructor(public navParams: NavParams) { 
    this.tabBarElement = document.querySelector('.tabbar.show-tabbar'); 
    this.data = this.navParams.get('item'); 
    console.log(this.data); 
    } 
} 

在此先感谢您。

回答

2

转到AppModule并将NavParams添加到providers阵列。

+0

不,它不起作用! –

+0

对于直接与文档相矛盾的内容,这非常有用 – Kai

相关问题