One Angular 4 component that I have is like this:
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;
});
}
}
An issue keeps popping up saying:
Property 'nodes' does not exist on type 'MenuComponent'
and I can't figure out why because the nodes
property is clearly defined in the component.