Batman Batman - 1 year ago 59
AngularJS Question

How to Pass the data from Main Window to Child Window to display large data in table using AngulaJS

Hi Currently my main intention of the question is avoid displaying large data in the

. So instead of that I want to display the data in the new window by clicking on the element of the table. Currently I am displaying the table using the AngularJS. I have done much research but not able to get the output.

I want in the similar way as show in this link, But instead of getting the value from Input box I want to get the value from ng-repeat in the td cell and ,when the cell is clicked new window should be popped up

Passing Data to New window Tutorial

Below is the demo of the my table where I am passing the large data in


Demo of the large table

Above is my table ,as you can see in the table. DATA column is very large(Around 500 Characters length in real but i have shown little less data) so I just want to keep click here kind of word. When user clicks then it should open in the new window and show the data.

Answer Source

You can do the same thing with below steps:

Note: New window won't work in the plunker. So you have to try this in realtime in your local.

I have updated the same in the following plunker link,

Step 1: Change your <tr> as below

<tr class="features" ng-repeat="list in opMessageLogs">
                        <td ng-click="showText(list.DATA)">{{shortText(list.DATA)}}</td>

Step 2: Add two methods in your controller as below

var app = angular.module('studentApp', []);

app.controller('StudentCntrl', function($scope,$http, $window) {
    $http.get('data.json').then(function (response){
                $scope.opMessageLogs =

    $scope.shortText = function(data) {
      if(data && data.length > 20) {
        return data.substring(0, 20) + '..';

      return data;


    $scope.showText = function(data) {
      var $popup = $"Popup.html", "popup", "width=250,height=100,left=10,top=150");
      $ = data;

Step 3: Create a new page Popup.html and add below html

<html xmlns="">
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">
        var app = angular.module('MyChildApp', [])
        app.controller('MyChildController', function ($scope, $window) {
            $ = $;
    <div ng-app="MyChildApp" ng-controller="MyChildController">
        Data: <span ng-bind="data"></span>

Recommendation: Instead of new window you can try a modal dialog with jquery dialog (or) other dialogs

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download