I\'m making a little application in Angular 2, I\'m displaying a table with some data, I wanna get that data when I make a click on my table
Here\'s the code:
HT
You need to create a public array in the component as like.
public usersdata:any;
data(data: string) {
this.usersdata = data;
console.log(this.usersdata);
} Now you can access in html template
{{users.username}}
{{users.email}}
{{users.id}}
{{users.roleId}}
data(data: string) {
this.selectedParam.emit(data);
console.log(data);
}
Above don't keep function name and parameter name same since it will may cause issue. Change name of the parameter
data(datavalue: string) {
this.selectedParam.emit(datavalue);
console.log(datavalue);
}
- 热议问题