存在我有這個角4部分:屬性不會對組件
export class MenuComponent {
constructor(private menuService: MenuService) { }
@Input(nodes):any;
getMenu(path:string): void {
this.menuService.getData(path).subscribe(data => {
// Read the result field from the JSON response.
let newValue = JSON.stringify(data).replace('{"Node":', '[');
newValue = newValue.substring(0,newValue.length - 1);
newValue+="]";
const menu=JSON.parse(newValue);
this.nodes = menu;
});
}
}
我不斷收到此錯誤:Property 'nodes' does not exist on type 'MenuComponent'
,我不知道爲什麼,因爲nodes
財產就在那裏。
'@Input()nodes:any;'? – jonrsharpe
它有什麼問題? – eli
請將我的評論與您實際寫的內容進行比較! – jonrsharpe