I tried to put the value to <input value="{{ val }}">
but I think its wrong because it returns empty data.
How can I set a default value to an input?
I already created API for update. I just really need to return the input data.
thanks
(keyup. enter) event is used to generate event when Enter key is pressed.
Use the @Input() decorator in a child component or directive to let Angular know that a property in that component can receive its value from its parent component. It helps to remember that the data flow is from the perspective of the child component.
The target event determines the shape of the $event object. If the target event is a native DOM element event, then $event is a DOM event object, with properties such as target and target. value . In the following example the code sets the <input> value property by binding to the name property.
You can use one-way input binding:
<input [value]="val">
or two-way input binding:
<input [(ngModel)]="val">
One-way will give you the value, and update it when the component updates it... but will not change the value with user input.
Two-way will change on user input as well as component changes.
use this. It will show the data as well as do a two way binding. you can change its value from code to view and from view to code.
<input [(ngModel)]="val">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With