2017-05-16 7 views
0

I have a page1 html with the following code合格値タグ<a (click)="myMethod()">

<ion-grid> 
    <a (click)="myMethod(categorys.name)" style="text-decoration:none;"> 
    <ion-row> 
     <ion-col col-5 col-sm-9 col-md-6 col-lg-4 col-xl-3 col-align-self: center style="border: 1px solid gray; margin: 0 5% 5% 2%;" *ngFor="let causa of causas"> 
     <h4><strong>Caso</strong></h4> 
     <p>{{ categorys.name }}</p> 
     </ion-col> 
    </ion-row> 
    </a> 
    </ion-grid> 

in my page1.ts I have one array of categorys

export class Page1 { 

    categorys: any = [ 
    { id: 1, name: 'Criminal' }, 
    { id: 2, name: 'Cível' }, 
    { id: 3, name: 'Empresarial' }, 
    { id: 4, name: 'Trabalhista' } 
    ]; 

    constructor(public navCtrl: NavController, public params: NavParams) { 
    //console.log(this.categorys[0].name); 
    } 

    myMethod(categoryName) { 
    this.navCtrl.push(
         Page2, { 
         name : categoryName 
         }); 
    } 

} 

I'm trying pass category without successuly to page 2 How pass values in this function

<a (click)="myMethod(category.name)" style="text-decoration:none;"> 

my Page2

category: any; 

constructor(public navCtrl: NavController, public navParams: NavParams) { 
    this.causa = navParams.get('name'); 
    console.log(this.causa); 
    } 
+0

Please add language hints in order to make the source code display correctly with highlights. –

+0

Your question is not clear. Please try to be specific and clear about what you want to ask. – monica

+0

sorry friends, I was trying to pass a parameter through of method in a click in tag

答えて