Click on an item and send to the specific page

Asked

Viewed 59 times

0

I’m new to Ionic and I wanted a tip from you. There was a fixed list in my app with the services that it has after creating this list in the main view I would like to click on a given item to go to the page of its particular function. When I click car on the screen it sends to the screen with the specifications.

I know you have Navcontroller, but I can’t do it .

any help is valid =)

Example

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

What I tried to :

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);
 }
  • Show what you’ve tried so far.

  • 1

    edited the Ucas question

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); }
  • Explain what you did, so it already makes it much easier. Only posting the code gets confused sometimes.

  • My answer was based on the code he put, he will understand exactly how to do if he looks at the code steps.

  • But there may be third parties who do not understand. If you can put explained, why not put!? It gets a business simply played, misidentified, etc... It don’t hurt to do it right.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.