user3660646
user3660646

Reputation: 43

In controller in angular js how to use console.log($window.result) to print data on screen

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

Upvotes: 0

Views: 736

Answers (2)

Asheesh Kumar
Asheesh Kumar

Reputation: 161

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

Upvotes: 0

Debasish Mohapatra
Debasish Mohapatra

Reputation: 856

Try

$window.document.write(result);

Upvotes: 1

Related Questions