Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getComponents(type: string): Observable<string[]> {
- return this.http.get('http://localhost:14373/api/devices/components/' + type)
- .map((response: Response) => response.json());
- }
- getComponentValues(type: string, component: string): Observable<string[]> {
- return this.http.get('http://localhost:14373/api/devices/components/' + type + '/' + component)
- .map((response: Response) => response.json());
- }
- ngOnInit() {
- this.subscription = this.route.params
- .subscribe(
- (params: any) => {
- this.currentType = params['type'];
- this.deviceService.getComponents(this.currentType).subscribe(
- (data: string[]) => {
- this.components = data;
- }
- );
- }
- );
- }
- <div class="panel panel-default" *ngFor="let component of components">
- <!-- Default panel contents -->
- <div class="panel-heading">{{component}}</div>
- <!-- List group -->
- <ul class="list-group">
- <li class="list-group-item" *ngFor="let val of getComponentValues(currentType, component)">
- {{val}}
- </li>
- </ul>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement