Change color of ion-item ionic

1

I'm trying to change the color of ionic-ionic item by clicking on it, I'm starting with angular and ionic and I do not really know how to do it. I know that it would be necessary to pass the id to the metedo click and once there to change it, but I do not know how to do it. thanks

html

 <ion-header>
<ion-navbar>
    <ion-title>
        Aplicacion
    </ion-title>
  </ion-navbar>
 </ion-header>

  <ion-content padding>

<ion-list *ngFor="let a of alumnos">
    <ion-item  color='dark' (click)='falta(id)'>
        <ion-avatar item-left>
            <img src="img/YO.png">
        </ion-avatar>
        <h2>{{a}}</h2>
    </ion-item> 
</ion-list>

.ts

 import { Component } from '@angular/core';
 import { NavController } from 'ionic-angular';

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


private alumnos = ["jose","yeste"];

constructor(public navCtrl: NavController) {

}

falta(id:string){
    console.log(id);

}
} 
    
asked by Jose Yeste 27.05.2017 в 17:40
source

1 answer

1

link

To modify styles of your application, you can do it just like a web page.

falta(id) {
  document.getElementById(id).style.color = "#ff0000";
}
    
answered by 20.07.2017 в 03:42