I want to show users which I got in "data" variable
I got an warning on line which says "object access via string literals is disallowed (no-string-literal)"
this.crud = data['msg'];
My class :
export class CrudClass {
public id?: string;
public name: string;
public email: string;
public password: string;
}
My Component :
export class ListComponent implements OnInit {
private crud: CrudClass[];
constructor(private router: Router, private apiRoutes: ApiRoutesService) { }
ngOnInit() {
this.readApp();
}
readApp() {
this.apiRoutes.readApp().subscribe(
data => {
console.log(data);
this.crud = data['msg'];
},
error => {
console.log(error);
}
);
}
}