0

I am getting the data from javascript object using below method in another page.I want to use this data to print on html page using angular js....Below is snippet of code I am using.

app.controller('tableCtrl', function($scope,$http,$window) {
    console.log($window.result);
     });

But it is not working

4
  • Try console.log($window) it would be sufisant i think Commented Jun 11, 2015 at 7:39
  • I want data to print on html page <div class="table" ng-controller="tableCtrl"> <table border="1"> <tr> <tr ng-repeat="a in resultObject"> <td ng-repeat="column in cols">{{a[COLUMN_NAME]}}</td> </tr> </table> </div> </div> Commented Jun 11, 2015 at 7:40
  • console.log() will not print on the html page but in the console. Commented Jun 11, 2015 at 7:43
  • Do as Debasish suggested - $window.document.write(result); Commented Jun 11, 2015 at 7:46

2 Answers 2

1

Try

$window.document.write(result);
Sign up to request clarification or add additional context in comments.

1 Comment

Still not able to work it out.Can you please help?......................... app.controller('tableCtrl', function($scope,$http,$window) { $window.document.write(result); $scope.resultObject= $window.result; }
0

will overwrite current document and write your result

$window.document.write(result);

if you want it in any of you html page include below snippet

in Html

<div ng-controller="tableCtrl">
    <span ng-bind="result"></span>
</div></code>

in tableCtrl

$scope.result = result; //whatever your result is

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.