0
I would like you to click a button, change page.
I’m in inicio
and would like to go to add-oferta
.
top html.
<ion-fab bottom right >
<button ion-fab color="secondary" (click)="addOferta()"><ion-icon name="add"></ion-icon></button>
</ion-fab>
home ts.
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { LOCALE_ID } from '@angular/core';
import { ServiceProvider } from '../../providers/service/service'
import { pageAddOferta } from '../add-oferta/add-oferta'
@IonicPage()
@Component({
selector: 'PaginaInicial',
templateUrl: 'inicio.html'
})
export class PaginaInicial {
produtos: any;
constructor(public navCtrl: NavController, public navParams: NavParams, public servidor: ServiceProvider) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad PaginaInicial');
}
getProdutos(ev: any) {
const val = ev.target.value;
if(val!=''){
this.servidor.getProdutos(val)
.subscribe(
data => this.produtos = data,
err => alert(err)
);
}
}
addOferta(){
this.navCtrl.setRoot(pageAddOferta);
}
}
But when triggering the desired function always appears the error below:
Uncaught (in promise): invalid views to insert
I don’t know where the mistake is or what I’m doing wrong. I saw that the function is called correctly, but never called the page I need.
Any suggestions?