"use strict"; angular.module("vocabulary") .component("lessonWordsClassified", { templateUrl: "/js/redesign-angular/lessons/lesson-words-classified.html", controller: "LessonWordsClassifiedController", bindings:{ topicId: "<" } }) .controller("LessonWordsClassifiedController", ["premadeService", "$filter", "partsOfSpeechService", function(premadeService, $filter, partsOfSpeechService){ var ctrl = this; this.$onInit = init; ctrl.highFrequency = []; ctrl.academicVocabulary = []; ctrl.enrichment = []; ctrl.storyCritical = []; function init(){ premadeService.getPremadeRazTopicWords(ctrl.topicId).then(function (words) { ctrl.highFrequency = $filter('filter')(words, {purpose: 'high_frequency'}); ctrl.academicVocabulary = $filter('filter')(words, {purpose: 'academic_vocab'}); ctrl.enrichment = $filter('filter')(words, {purpose: 'enrichment'}); ctrl.storyCritical = $filter('filter')(words, {purpose: 'premade_lesson'}); }); } ctrl.haveHighFrequency =function(){ return ctrl.highFrequency.length > 0; }; ctrl.haveAcademicVocabulary =function(){ return ctrl.academicVocabulary.length > 0; }; ctrl.haveEnrichment = function(){ return ctrl.enrichment.length > 0; }; ctrl.haveStoryCritical =function(){ return ctrl.storyCritical.length > 0; }; ctrl.hasAbbreviationForPartOfSpeech = partsOfSpeechService.hasAbbreviation; ctrl.abbreviatePartOfSpeech = partsOfSpeechService.abbreviate; } ]);