The version of post
accepting responseType:'text'
is not generic, since the result type is already clear (ie string
)
this.http
.post(this.loginUrl, this.user, {responseType: 'text'}) // no generic parameter
.subscribe(
(data) => this.success(data), // data is string
(error) => this.failure(error)
);