I have a bunch of list items and would like to highlight each one once it\'s clicked. This is easy for me to do in jQuery or even JavaScript but I\'m lost when it comes to Angul
If I am understanding the question properly, I believe you can also use the render from angular2 to get a similar code to your example code. For my own project I did the following:
In my template I have:
- Local
In my component I then have:
import {Renderer} from '@angular/core';
//other imports
export class SignupComponent implements OnInit {
constructor(private render:Renderer) { }
userTypeSelect(event:any){
event.preventDefault()
this.render.setElementClass(event.target,"active",false);
}
}
It is worth noting though that I am not using this for a list of items, however I believe it should still work.
Reference to the Renderer: Renderer Api Docs