Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. getComponents(type: string): Observable<string[]> {
  2. return this.http.get('http://localhost:14373/api/devices/components/' + type)
  3. .map((response: Response) => response.json());
  4. }
  5.  
  6. getComponentValues(type: string, component: string): Observable<string[]> {
  7. return this.http.get('http://localhost:14373/api/devices/components/' + type + '/' + component)
  8. .map((response: Response) => response.json());
  9. }
  10.  
  11. ngOnInit() {
  12. this.subscription = this.route.params
  13. .subscribe(
  14. (params: any) => {
  15. this.currentType = params['type'];
  16. this.deviceService.getComponents(this.currentType).subscribe(
  17. (data: string[]) => {
  18. this.components = data;
  19. }
  20. );
  21. }
  22. );
  23.  
  24. }
  25.  
  26. <div class="panel panel-default" *ngFor="let component of components">
  27. <!-- Default panel contents -->
  28. <div class="panel-heading">{{component}}</div>
  29. <!-- List group -->
  30. <ul class="list-group">
  31. <li class="list-group-item" *ngFor="let val of getComponentValues(currentType, component)">
  32. {{val}}
  33. </li>
  34. </ul>
  35. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement