在不定义角度服务的情况下在页面之间传递范围

时间:2017-10-04 14:58:19

标签: javascript angularjs html5

我想通过传递$ scope来打开一个新的jsp页面,因为我想使用在第一个创建的数组响应。 我的test.js示例:

(function() {

    'use strict';

    angular
    .module('test', [])
    .controller('TestCtrl', function($scope, $rootScope, communication, serviceRequest,$window) {

        // header example
        $rootScope.pageTitle = 'DEMO';
        $rootScope.pageSubtitle = 'Demo';

        var successCallback = function(response) {
            $rootScope.loading = false;
            $scope.testResponseObj = response;
            $scope.testResponse = JSON.stringify(response);
            $scope.testResponseSerialized = angular.fromJson(response);
            $window.open("index2.jsp", '_blank','heigth=600,width=600');   // may alse try $window
        };

你有什么建议吗?

由于

1 个答案:

答案 0 :(得分:0)

var $yourFile = $window.open("index2.jsp","_blank","width=250,height=100,left=10,top=150");

$yourFile.response = response;

和你的孩子控制器:

var response = $window.response;