Click on an item and send to the specified page

0

I'm new to ionic and wanted a tip from you guys. You have a fixed list in my app with the services that it provides after creating this list in the main view I would like to click on a certain item to go to the page of your particular function.  When I click car on the screen it sends to the screen with the specs.

I know you have the NavController, but I can not do it.

Any help is valid =)

Example

this.opcoes = [
        {nome:'carro'},
        {nome:'moto'},
        {nome:'barco'},
        {nome:'aviões'},
       ];
  }

What I've tried:

import{ carro } from '../escolha/carro';

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

  public opcoes;

 //public String op = [];

  constructor(public navCtrl: NavController) {

    this.opcoes = [
        {nome:'carro'},
        {nome:'moto'},
        {nome:'barco'},
        {nome:'aviões'},

    ];
  }
  goToPage() {
    this.opcoes[0] = this.navCtrl.setRoot(carro);
 }
    
asked by anonymous 12.03.2018 / 19:47

1 answer

0
export class HomePage {  
     opcoes: Array<any> = [];  

.... }

constructor() {

this.opcoes.push({name:'Carros',function:'novoCarro' }); this.opcoes.push({name:'Motos',function:'novaMoto'});

}  

novoCarro(){ this.navCtrl.push(NomePaginaCarros); }

novaMoto(){ this.navCtrl.push(NomePaginaMoto); }
    
19.07.2018 / 19:48