Two way data binding in AngularJS Directives

前端 未结 3 1779
情深已故
情深已故 2020-12-08 10:10

I have been trying to define directives so I can display different \"widgets\" in a form, depending on the type of field and its parameters, which are stored in a database.

3条回答
  •  自闭症患者
    2020-12-08 10:33

    You mean something like this ?

    I basically use @Flek's example.
    The only difference being ng-model='title'

    The trick to doing two-way binding is ng-model, and it states in the document:

    ngModel is directive that tells Angular to do two-way data binding. It works together with input, select, textarea. You can easily write your own directives to use ngModel as well.

    
    

提交回复
热议问题