Home > Mobile >  My angular component is not updated when using routerLink
My angular component is not updated when using routerLink

Time:01-28

I have the following problem: when I modify a field in the edit-conceptos component with the <a href="conceptos/edit-conceptos/{{ concepto.id}}"> tag and return to the list-conceptos component, the changes are reflected, but this does not happen with routerLink="../edit-conceptos/{{ concepto.id }}.

I am consuming both the list service and the update service with apollo-client.

the following component takes care of listing

ngOnInit(): void {
this.conceptoService.getConceptos().
subscribe(
  (res) => {
    this.conceptos = [...res];
  }
  (err) => {
    console.log(err)
  }
)}

enter image description here

thank you

CodePudding user response:

Try in this way:

<a [routerLink]="[‘/edit-conceptos’, concepto.id]">

NOTE: Take a look of the typo in your image "list-concetos", instead "list-conceptos"

CodePudding user response:

The routerLink equivalent of href in your case would be:

[routerLink]="['edit-conceptos', concepto.id]"
  •  Tags:  
  • Related