Bind new html to controller after calling trustAsHtml Angularjs

后端 未结 2 700
没有蜡笔的小新
没有蜡笔的小新 2021-01-23 08:28

I\'m able to embed the new html once received from the server but later I need to bind it to the model. Even when I compile it 5 seconds after it\'s inserted and displayed the h

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-23 09:12

    Take a look at the answer to this related question, which describes using a directive to compile the template:

    It's a bit tricky because ng-bind-html will simply insert plain old html and not bother compiling it (so any directives in the html will not be processed by angular.

    Here's a demo, incorporating the suggested technique with your code.

提交回复
热议问题