(function(){ "use strict"; angular.module("raz") .component('resourceCardCategory', { templateUrl: '/js/angular/resource-card/resource-card-category.html', controller: 'resourceCardCategory', bindings: { category: '@' } }) .controller('resourceCardCategory', ['resourceCardService', function(resourceCardService){ var ctrl = this; ctrl.resourceCardIds = null; ctrl.displayError = false; ctrl.categories = resourceCardService.getCategories(); ctrl.$onInit = getResourceCardIdsByCategory; function getResourceCardIdsByCategory(){ if (ctrl.category === "English Language Learning") ctrl.category = "ELL"; //TODO update category name in DB during Aug-September cycle ctrl.resourceCardIds = resourceCardService.getResourceCardIdsByCategory(ctrl.category) ctrl.displayError = !ctrl.resourceCardIds.length; } }]) })();