I have an Angular
application in which errors are beginning to appear in the subscribe
that they are deprecated.
This is my subscribe:
this.route.params.subscribe(params => {
this.clienteId = +params['clienteId'];
this.isNew = !this.clienteId;
if (!this.isNew) {
this.clienteService.get(this.clienteId).subscribe(c => {
this.cliente = c;
this.formNuevo.patchValue(this.cliente);
});
}
});
This is the client-service.ts
(get
):
public get(idClient: number): Observable<Client> {
return this.http.get<Client>(`${PREFIX}/${idClient}`);
}
This is the error of the new subscribe:
-> 'clienteId'
: object access via string literals is disallowed (no-string-literal)tslint(1)
-> subscribe
: subscribe is deprecated: Use an observer instead of a complete callback (deprecation)tslint(1)
How can I solve the problem and apply the changes to this subscribe?