Angular ng-model not working when html is rendered by js


I have a jquery plugin, that renders some html in the DOM. I set ng-model attribute to injected html in that jquery plugin.

After page loading has finished, ng-model doesn't bind to angular.

Attributes are added from jquery:

attributes: {
    dir               : "ltr",
    spellcheck        : false,
    "ng-model"        : "userContent",
    id                : "myID"

After page loading, this will be added to html:

<div dir="ltr" spellcheck="false" ng-model="userContent2" id="myID" contenteditable="true">Test</div>

NOTE: I tested with html, that already exist in the DOM. (It does't relate to contenteditable)

Show source
| javascript   | dom   | jquery   | angularjs   2017-01-07 15:01 0 Answers

Answers ( 0 )

◀ Go back