Source: fedramp.components/dictionary.component.js

  1. (function () {
  2. 'use strict';
  3. angular
  4. .module('fedramp.components')
  5. .component('dictionary', {
  6. transclude: true,
  7. templateUrl: 'templates/components/dictionary.html',
  8. controller: DictionaryController,
  9. controllerAs: 'controller'
  10. });
  11. DictionaryController.$inject = ['DataService'];
  12. /**
  13. * @constructor
  14. * @memberof Components
  15. */
  16. function DictionaryController (DataService) {
  17. var self = this;
  18. // Original list of dictionary items
  19. self.dataDictionary = [];
  20. // Filtered dictionary items
  21. self.filteredDictionary = [];
  22. // Public functions
  23. self.$onInit = $onInit;
  24. self.onUpdate = onUpdate;
  25. /**
  26. * Initializes component and queries for data dictionary.
  27. */
  28. function $onInit () {
  29. DataService
  30. .pullDataDictionary()
  31. .then(function (dataDictionary) {
  32. self.dataDictionary = dataDictionary;
  33. });
  34. }
  35. /**
  36. * When grid is filtered, updates array to render updated items
  37. */
  38. function onUpdate (items) {
  39. self.filteredDictionary = items;
  40. }
  41. }
  42. })();