Angurlarjs的范围

时间:2018-05-09 05:13:29

标签: angularjs-scope

var myApp = angular.module("appModule", ["integralui"]);
myApp.controller("appCtrl", function($scope,$http){
     $http.get('http://localhost:8080/er')
     .then(function(response) {
         window.alert(JSON.stringify(response.data));
         $scope.datacheck = response.data;
        $scope.treeName = "treesample";
        $scope.showLines = true;
        $scope.toggleLines = function(elem){
            $scope.showLines = !$scope.showLines;
        }
        $scope.datacheck =[
                        { 
                            id: 1,
                            text: "Item1",
                            items: [
                                { id: 11, pid: 12, text: "Item12" },

                            ]
                        },
                        { id: 7, text: "Item7" }
                    ];

     });         
     $scope.data =[
                    { 
                        id: 1,
                        text: "Item1",
                        items: [
                            { id: 11, pid: 1, text: "Item12" },

                        ]
                    },
                    { id: 7, text: "Item7" }
                ];

});

当我试图从数据库中获取数据并将其放入scope.datacheck时,它不能使用我使用的treeview插件。 scope.data工作正常。有人能帮忙吗 ?

0 个答案:

没有答案