0

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:

$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?

Riccardo
  • 26
  • 4
  • http://stackoverflow.com/questions/19845950/angularjs-how-to-dynamically-add-html-and-bind-to-controller – akgaur Dec 07 '15 at 10:44

1 Answers1

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.

ng-bind will render the html stored inside $scope.data on the view.

Reference

Vivek
  • 11,938
  • 19
  • 92
  • 127