"use strict"; angular.module("vocabulary") .component("premadeEllVocabBooks", { templateUrl: "/js/redesign-angular/premadeLessons/premade-resources-display.html", controller: "PremadeEllVocabBookController", bindings: { categoryId: "<", parentCategoryId: "<", levels: "<", resources: "<", onUpdateNavigation: "&" } }) .controller("PremadeEllVocabBookController", ["$filter", function ($filter) { var ctrl = this; this.$onInit = init; ctrl.filterField = "level"; 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, 'sortableTitle'); }; ctrl.numColumnsIsFour = function(){ return true; }; ctrl.numColumnsIsThree = function(){ return false; }; }]);