-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2063 from HealthCatalyst/dev
Cashmere 13.7.2
- Loading branch information
Showing
24 changed files
with
172 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 6 additions & 27 deletions
33
...ects/cashmere-examples/src/lib/selected-tab-input/selected-tab-input-example.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,21 @@ | ||
import {Component, OnDestroy, OnInit} from '@angular/core'; | ||
import { Component } from '@angular/core'; | ||
import { FormControl } from '@angular/forms'; | ||
import { TabChangeEvent } from '@healthcatalyst/cashmere'; | ||
import { Subject } from 'rxjs'; | ||
import { map, takeUntil } from 'rxjs/operators'; | ||
|
||
@Component({ | ||
selector: 'hc-selected-tab-input-example', | ||
templateUrl: 'selected-tab-input-example.component.html', | ||
// TODO: delete the SCSS file if you don't need it in the example | ||
styleUrls: ['selected-tab-input-example.component.scss'] | ||
}) | ||
export class SelectedTabInputExampleComponent implements OnInit, OnDestroy { | ||
|
||
tabSelected = new FormControl(1); | ||
currentSelected = 1; | ||
unsubscribe = new Subject<void>(); | ||
export class SelectedTabInputExampleComponent { | ||
tabSelected = new FormControl(2); | ||
currentSelected = 2; | ||
|
||
selectionChanged(event: TabChangeEvent): void { | ||
this.tabSelected.setValue(event.index); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.tabSelected.valueChanges.pipe( | ||
map(value => { | ||
if (value) { | ||
return Number(value); | ||
} | ||
|
||
return 0; | ||
}), | ||
takeUntil(this.unsubscribe) | ||
).subscribe(value => { | ||
this.currentSelected = value; | ||
}); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.unsubscribe.next(); | ||
this.unsubscribe.complete(); | ||
controlChanged(): void { | ||
this.currentSelected = Number(this.tabSelected.value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.