(function() { "use strict"; angular.module("raz") .component('fsScopeSequence', { templateUrl: '/js/angular/literacy-curriculum-map/routes/fs-scope-sequence.html', controller: 'fsScopeSequenceController', bindings: { gradeId: '<' } }) .controller("fsScopeSequenceController", ['lcmGradeService', 'lcmGradeFolderIds', '$scope', function (lcmGradeService, lcmGradeFolderIds, $scope) { var ctrl = this; ctrl.isPending = false; var tablesRendered = 0; ctrl.$onInit = function () { lcmGradeService.setCurrentGradeId(ctrl.gradeId); setUnits(); }; ctrl.isLoading = function () { return ctrl.isPending; }; $scope.$on('SSTableLastElem', function (event) { tablesRendered++; if (tablesRendered === 1) { ctrl.isPending = false; } }); function setUnits() { ctrl.isPending = true; lcmGradeService.getFSSSWeeksTreeById(lcmGradeFolderIds['grade_' + ctrl.gradeId]['folder_id']) .then(function (response) { ctrl.units = response; }); } }]); })();