Hi, I’m new here on ionic. I got this error trying to make the modal work. could you help me?
Thank you very much in advance
Topo.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ViewController, ModalController } from 'ionic-angular';
import { ServicesNav } from '../../providers/services-nav';
import { SpeechProvider } from '../../providers/speech/speech';
import { BarcodeProvider } from '../../providers/barcode/barcode';
import { ProductImageHelper } from '../../util/product-image-helper';
import { StorageProvider } from '../../providers/storage/storage';
import { MenuNotificationProvider } from '../../providers/menu-notification/menu-notification';
//modal teste
//import { ModalBuscaPage } from '../../pages/modal-busca/modal-busca';
//modal teste
/**
* Generated class for the Topo component.
*
* See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html
* for more info on Angular Components.
*/
@IonicPage()
@Component({
selector: 'topo',
templateUrl: 'topo.html'
})
export class Topo {
public searchText : string;
tituloBarra = "JáCotei";
searchQuery: string = '';
suggest : any = {};
imgHelper = ProductImageHelper;
rewards : any[] = [];
constructor(
private barcode: BarcodeProvider,
public servicesNav : ServicesNav,
public navCtrl: NavController,
public navParams: NavParams,
private speech: SpeechProvider,
private storageProvider:StorageProvider,
private menuNotificationProvider:MenuNotificationProvider,
private viewCtrl: ViewController,
//modal
public modal: ModalController
) {
}
//modal
openModal(){
let modal = this.modal.create('ModalBuscaPage');
modal.present();
}
scan(){
this.barcode.scan().subscribe(code => {
if(code){
this.servicesNav.push('resultadoBusca', {searchText : code, analyzer : 'literal'});
}
})
}
speak(){
this.speech.speak().subscribe(text => {
if(text){
this.searchText = text;
this.search();
}
});
}
typing(ev:any){
console.log('typing', ev);
}
search() {
console.log('search', this.searchText);
this.servicesNav.push('resultadoBusca', {searchText : this.searchText});
}
openSugest(){
this.servicesNav.push('suggest');
}
hasNotifications() : boolean {
return this.menuNotificationProvider.hasNotifications();
}
goBack() {
this.viewCtrl.dismiss();
}
isChild() : boolean {
if (this.navCtrl.length() - 1 == 0) {
return false;
}else{
return true;
}
}
}
modal-busca.module.ts
import { NgModule } from '@angular/core';
import { IonicModule } from 'ionic-angular';
import { ModalBuscaPage } from './modal-busca';
@NgModule({
declarations: [
ModalBuscaPage,
],
// imports: [
// IonicModule.forChild(ModalBuscaPage),
// ],
exports: [
ModalBuscaPage
]
})
export class ModalBuscaPageModule {}
modal-busca.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
/**
* Generated class for the ModalBuscaPage page.
*
* See http://ionicframework.com/docs/components/#navigation for more info
* on Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-modal-busca',
templateUrl: 'modal-busca.html',
})
export class ModalBuscaPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad ModalBuscaPage');
}
}