The server return code html and i would insert this code in page. But if I insert with jquery , angular directive not function. My code into controller:
服务器返回代码html,我会在页面中插入此代码。但是如果我用jquery插入,则angular指令不起作用。我的代码进入控制器:
$scope.submit = function() {
$http({
method: 'POST',
url: 'find.php',
data:{url:$scope.url}
}).then(function successCallback(response) {
$("#center").remove();
var data=response.data;
$("#result").html(data);
}, function errorCallback(response) {
$("#center").remove();
$("#result").html("ERRORE");
});
}
This example is in Jquery. How in Angular?
这个例子在Jquery中。 Angular怎么样?
1 个解决方案
#1
0
In your success handler, You can store the response data into $scope
variable, Like $scope.data=response.data;
. Then you can use ng-bind="data"
in your html.
在您的成功处理程序中,您可以将响应数据存储到$ scope变量中,例如$ scope.data = response.data;。然后你可以在你的HTML中使用ng-bind =“data”。
ng-bind
will render the html stored inside $scope.data
on the view.
ng-bind将呈现存储在视图中$ scope.data内的html。
#1
0
In your success handler, You can store the response data into $scope
variable, Like $scope.data=response.data;
. Then you can use ng-bind="data"
in your html.
在您的成功处理程序中,您可以将响应数据存储到$ scope变量中,例如$ scope.data = response.data;。然后你可以在你的HTML中使用ng-bind =“data”。
ng-bind
will render the html stored inside $scope.data
on the view.
ng-bind将呈现存储在视图中$ scope.data内的html。