Skip to content
Advertisement

@Input and @Output are always undefined in Angular-Cli

Whatever values are inside the individuals are printed without issues but whatever is obtained using @Input or @Output is not displayed.

child.component.ts

JavaScript

parent.component.html

JavaScript

Is there anything goes wrong in syntax? The Log always show ‘undefined’ in all cases.

Thanks

Advertisement

Answer

I think this is trying to pull in a variable defined within your component.

Try the following syntax, wrap the string again, this should ensure you are passing a string and not a variable from the component, the input will then know to expect a string.

JavaScript

This is wrapping the string in " and '.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement