"use strict"; angular.module("vocabulary") .component("languageProficiencyStandards", { templateUrl: "/js/redesign-angular/standardsAndCorrelations/standards/language-proficiency-standards.html", controller: "LanguageProficiencyStandardsController" }) .controller("LanguageProficiencyStandardsController", ["standardsAndCorrelationsService", "$sce", function (standardsAndCorrelationsService, $sce) { var ctrl = this; this.$onInit = init; ctrl.edGateUrl = ""; ctrl.haveEdGateUrl = false; ctrl.selectedStandard = null; ctrl.gradeList = null; function init() { standardsAndCorrelationsService.setActiveStandardsCategory('languageProficiency'); ctrl.haveEdGateUrl = false; } function toggleEdGateDisplayOff(){ ctrl.edGateUrl = ""; ctrl.haveEdGateUrl = false; } ctrl.setSelectedStandard = function (standard){ if(ctrl.selectedStandard !== standard) { ctrl.selectedStandard = standard; ctrl.gradeList = standardsAndCorrelationsService.getGradeListForStandard(standard); if(ctrl.gradeList !== null){ ctrl.selectedGrade = ctrl.gradeList[0].value; } toggleEdGateDisplayOff(); } }; ctrl.changeGrade = function(){ toggleEdGateDisplayOff(); }; ctrl.isSelectedStandard = function(standard){ return ctrl.selectedStandard === standard; }; ctrl.haveGradesToShow = function(){ return ctrl.gradeList === null; }; ctrl.updateStandards = function(){ console.log ("selected grade is:" + ctrl.selectedStandard ); console.log("selected state is: " + ctrl.selectedState); ctrl.edGateUrl = $sce.trustAsResourceUrl(standardsAndCorrelationsService.getRequestUrl(ctrl.selectedGrade, ctrl.selectedStandard, 'EL')); ctrl.haveEdGateUrl = true; } } ]);