ng-model binding not working on div

后端 未结 3 562
我寻月下人不归
我寻月下人不归 2020-12-16 11:57

The two binding of AngularJS is not working on div. I want my div to be editable but it\'s not happening. Could anybody please suggest what could be wrong? The same binding

3条回答
  •  甜味超标
    2020-12-16 12:21

    that's the correct behaviour. from angular docs "ng-model Is a 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."

    in other words, if you want it to work with a div declare a directive which binds the model to the innerhtml of the div. docs here

提交回复
热议问题