I'm new to AngularJS 2 and this is my first time trying to compile it with TSlint. I did Tour of Heroes tutorial, and there is a part like the one below, which TSlint doesnt want to compile saying object access via string literals is disallowed.
ngOnInit(): void {
this.route.params.forEach((params: Params) => {
let id = +params['id'];
this.projectService.getProject(id)
.then(project => this.project = project);
});
}
I'm not sure if I understand the problem and I'm lost if it comes to solving it. Could you help me, please?
My other codes
getProjects(): Promise<Project[]> {
return this.http.get(`${this.configuration.Server}projects${this.configuration.ApiUrl}`)
.toPromise()
.then(response => response.json())
.catch(this.handleError);
}
getProject(ident: number): Promise<Project> {
return this.getProjects()
.then(projects => projects.find(project => project.id === id));
}