How to implement ngModel on custom elements?
问题 Given a simple input element I can do this: <input [(ngModel)]="name" /> {{ name }} This doesn't work for my custom elements: <my-selfmade-combobox [(ngModel)]="name" values="getValues()" required></my-selfmade-combobox> How can I implement it? 回答1: I think this link will answer your question: Angular 2 custom form input We need to implement two things to achieve that: A component that provides the logic of your form component. It doesn't need an input since that will be provided by ngModel