[英]My angular component is not updated when using routerLink
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 }} .我有以下问题:当我使用
<a href="conceptos/edit-conceptos/{{ concepto.id}}">
标记修改 edit-conceptos 组件中的字段并返回到 list-conceptos 组件时,更改已反映,但routerLink="../edit-conceptos/{{ concepto.id }}不会发生这种情况。
I am consuming both the list service and the update service with apollo-client.我正在使用 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谢谢你
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"注意:看一下图片中的拼写错误"list-concetos" ,而不是 "list-conceptos"
The routerLink
equivalent of href
in your case would be:在您的情况下,与
href
等效的routerLink
将是:
[routerLink]="['edit-conceptos', concepto.id]"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.