Contenteditable with ng-model doesn't work

后端 未结 3 1795
轻奢々
轻奢々 2020-12-03 05:22

I\'m trying to store the value of a contenteditable to my JS code. But I can\'t find out why ng-model doesn\'t work in this case.

&         


        
3条回答
  •  自闭症患者
    2020-12-03 06:27

    Neither of the other answers worked for me. I needed the model's initial value to be rendered when the control was initialized. Instead of calling read(), I used this code inside the link function:

    ngModel.$modelValue = scope.$eval(attrs.ngModel);
    ngModel.$setViewValue(ngModel.$modelValue);
    ngModel.$render()
    

提交回复
热议问题