在控制器之间传递数据时出错

时间:2019-01-24 16:30:08

标签: angularjs

我正在尝试使用从文件中解析出的变量填充textaread。调用弹出窗口时,textarea从控制器获取数据。该控制器从另一个已解析数据的控制器获取数据。但这会给注射带来错误。请帮忙。

重现行为的步骤 1.我有一个viewXML控制器 ///为ViewXML创建控制器-数据将显示在文本区域

angular.module('fbsiperf').controller('ViewXMLCtrl', ['$scope','successcount',function($scope,successcount) {
$scope.successcount=successcount;
$scope.cancel = function() {
       $scope.$dismiss();
}
}])

2。 它从下面的函数获取数据

angular.module('fbsiperf').controller('zScriptResultsCtrl', [ '$scope', '$http', '$state', '$stateParams', '$uibModal', 'Upload', function($scope, $http, $state, $stateParams, $uibModal, Upload) {
    var rowRendered = 0;
    init(); 
    function init() {
        /** *******method list: get Data *************** */
        $http.get("/xml/getResults").success(function(data, status) {
            $scope.results = data;
            $scope.totalScripts = data.length;
            var success = 0;
            var fail = 0;
            $scope.symbolicViewList = [];
            $scope.mauiViewList = [];
            $.each($scope.results, function(index, element) {
                if (element.result != null && element.result == "Passed") {
                    success++;
                } else {
                    fail++;

            });
            $scope.successCount = success;
            $scope.failCount = fail;

        });
    }
    var symbolicViewSearch = null;
    var mauiViewSearch = null;
    var prodCodeSearch = null;
    var zscriptResultDefs = [
        {
            headerName : "View XML",
            field : "viewXML",
            width : 150,
            unSortIcon : true,
            cellRenderer : function(params) {
                return "<a ng-click=\"viewXML()\">XML</a>";}

            },{
        headerName : "MAUI View",
        field : "mauiView",
        width : 150,
        unSortIcon : true,
        filter : 'text'
    }


    // View XML
    $scope.viewXML = function() {
        //if(null != $scope.ticket && "" != $scope.ticket) {
        if(true) {
            //open modal for adding data
            var modalInstance = $uibModal.open({
                templateUrl : '../../views/templates/viewXML.html',
                controller : 'ViewXMLCtrl',
                windowClass : 'center-modal',
                backdrop : 'static',
                keyboard : false,
                size : 'lg',
                resolve : {
                    successcount : function() {
                        console.log($scope);
                        console.log($scope.successCount);
                            return $scope.successCount;
                        //return "Name";
                    }
                }
            });
        } else {
            alert("No CM# found")
        }
    }

3。 我在这里用html显示

<textarea rows="4" cols="50" ng-model="successcount"></textarea>

而不是填充文本框,我得到的错误是

  

[$ injector:unpr]未知提供程序:successcountProvider <-成功计数<-ViewXMLCtrl

0 个答案:

没有答案