app-document-tree-view.ctrl.js 940 Bytes
Newer Older
eddie.woo's avatar
eddie.woo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
frameworkModule.
controller('AppDocumentTreeViewController', ['$scope', '$rootScope', '$attrs', 'documentHierarchyService',
    function ($scope, $rootScope, $attrs, documentHierarchyService) {

        $scope.enableSelect = $attrs.enableSelect;
        $scope.isCollapse = $attrs.isCollapse || false;
        documentHierarchyService.getDocumentHierarchy($attrs.documentType).success(function (documentHierarchy) {
            $scope.documentHierarchy = documentHierarchy;
            $scope.$emit('to-parent', $scope.documentHierarchy);
        });

        documentHierarchyService.getDocumentList($attrs.documentType).success(function (documentList) {
            $rootScope.documentList = documentList; //uses in material-list
        });


        $scope.selectDocument = function (document, parent, clickwhere) {
            $scope.documentClick({ document: document, parent: parent, clickwhere: clickwhere });
        }
    }
]);