HTTP Exercises#43
Conversation
| const userUrl = this.baseUrl + 'users/login'; | ||
| this.http.post(userUrl, { user: this.hardcodedUser }) | ||
| .subscribe((response) => { | ||
| const token = response["user"]["token"]; |
There was a problem hiding this comment.
en este caso no deberias usar ["sring"] si te fallaba el tipo podes especifcar en l linea anterior el repsponse como any
haciando
.subscribe((response: any) => {
o bien creano el tipo correspondiente para la respuesta de ese post y haciendo
.subscribe((response: LoginResponse) => {
| } | ||
| ) | ||
| .subscribe((res) => { alert("Comment uploaded successfully") }), | ||
| (err: any) => { console.log(err); } |
There was a problem hiding this comment.
esta bien esto en un ejercicio como esto pero sino no es conveniente manejar los errores sino los vamos a manear erealmente este comportamiento ya lo hace angular de que si falla te lo muestra por consola, el tema con esto es que al no saltar la excepcion es mas dificil de detectar.
| .subscribe((res) => { alert("Comment uploaded successfully") }), | ||
| (err: any) => { console.log(err); } | ||
| }), | ||
| (err: any) => { console.log(err); } |
| <h1>{{article.title}} </h1> | ||
| <div class="tagList"> | ||
| <div *ngFor="let tag of tags" class="tag"> | ||
| <span *ngIf="!(tag.indexOf('‌') > -1)"> |
There was a problem hiding this comment.
estas comprobaciones mejor hacerlas en un metodo del component no directamente en el template, tratemos de sacar la logica de os templates aunque sea minima
No description provided.