angular.js - angularjs动态增加DOM
ringa_lee
ringa_lee 2017-05-15 17:05:32
0
2
541

我是用append动态增加的,但是内容不能绑定了

$("#chat").append("<p class='eve_chat clearfloat'><p style='width:calc(98% - 50px);' class='clearfloat mb10'><img src='../../img/goods/3.jpg' class='chat_face left'><p class='chat_pop_left'><p class='chat_content left'><p>{{messages.messagetxt}}</p></p></p></p></p>")

请问有什么办法么?

ringa_lee
ringa_lee

ringa_lee

reply all(2)
大家讲道理

Because your Html is asynchronous, you need to use the $compile service to compile manually
Remember to dependency injection $compile

var el=$compile("HTML代码")(scope); $('#chat').append(el);
伊谢尔伦

Use

 $compile("<p></p>")($scope)
 

Come and bind~~

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template