Advertisement
Guest User

sds-tab.ts

a guest
Jan 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { Sds } from '../../_models/sds';
  3. import { SdsService } from '../../_services/sds.service';
  4.  
  5. @Component({
  6. selector: 'app-sds-tab',
  7. templateUrl: './sds-tab.component.html',
  8. styleUrls: ['./sds-tab.component.scss'],
  9. })
  10. export class SdsTabComponent implements OnInit {
  11. tabs: any[] = [ ];
  12. lowerAlph: any[] = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
  13. 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
  14. sdsSheets: Sds[];
  15.  
  16. constructor(private sdsService: SdsService) { }
  17.  
  18. ngOnInit() {
  19. this.buildTabs();
  20. }
  21.  
  22. buildTabs() {
  23. this.lowerAlph.forEach(element => {
  24. this.tabs.push({
  25. title: element.toUpperCase(),
  26. content: '',
  27. });
  28. this.loadSds(element);
  29. });
  30. }
  31.  
  32. loadSds(letter) {
  33. this.sdsService.getSdsList(letter).subscribe((sdsSheets: Sds[]) => {
  34. this.sdsSheets = sdsSheets;
  35. });
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement