My question is referring to all Angular versions >= 2
So for two-way data binding, does Angular support it out of the box using ngModel. Is it only supported for form controls e.g. input box ?
Is the out of box support not available for custom components ? e.g. can we not use ngModel directly as below for a custom component ? Or would that need custom code ?
<custom-counter [(ngModel)]="someValue"></custom-counter>
Angular provides
ControlValueAccessorto have control over custom components.ControlValueAccessor interface gives the power to leverage the Angular forms API, and create a connection between it and the DOM element.
Here is the example that implements this concept:
https://almerosteyn.com/2016/04/linkup-custom-control-to-ngcontrol-ngmodel