"use strict"; angular.module("vocabulary") .component("premadeEllPowerPack", { templateUrl: "/js/redesign-angular/premadeLessons/premade-resources-display.html", controller: "PremadeEllPowerPackController", bindings: { categoryId: "<", parentCategoryId: "<", levels: "<", resources: "<", onUpdateNavigation: "&" } }) .controller("PremadeEllPowerPackController", ["$filter", function ($filter ) { var ctrl = this; this.$onInit = init; ctrl.filterField = 'areaTopic'; ctrl.sortOrderClause='title'; ctrl.numColumns='3'; ctrl.inclusiveFiltering = true; ctrl.requiresFiltering = true; function init(){ ctrl.onUpdateNavigation({ $event:{ selectedParentCategoryId: parseInt(ctrl.parentCategoryId, 10), selectedSubCategoryId: parseInt(ctrl.categoryId, 10) } }); ctrl.filteredResources = ctrl.resources; } ctrl.updateFilteredResources = function(event){ ctrl.filteredResources = $filter('orderBy')(event.filteredResources, 'title'); }; ctrl.numColumnsIsFour = function(){ return true; }; ctrl.numColumnsIsThree = function(){ return false; }; }]);