-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52dd49f
commit 69803ad
Showing
6 changed files
with
144 additions
and
38 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<div class="time-elapsed"> | ||
<!-- important --> | ||
<c8y-countdown-interval | ||
[countdownInterval]="10000" | ||
(countdownEnded)="onCountdownEnded()" | ||
></c8y-countdown-interval> | ||
<!-- /important --> | ||
</div> | ||
<div class="container-fluid p-24 text-center"> | ||
<button | ||
class="btn btn-default" | ||
(click)="startCountdown()" | ||
> | ||
Start | ||
</button> | ||
<button | ||
class="btn btn-default" | ||
(click)="stopCountdown()" | ||
> | ||
Stop | ||
</button> | ||
<button | ||
class="btn btn-default" | ||
(click)="stopCountdownAtZero()" | ||
> | ||
Stop at 0 | ||
</button> | ||
<button | ||
class="btn btn-default" | ||
(click)="resetCountdown()" | ||
> | ||
Reset | ||
</button> | ||
</div> | ||
` |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { AfterViewInit, Component, ViewChild } from '@angular/core'; | ||
import { | ||
CommonModule, | ||
CountdownIntervalComponent, | ||
CountdownIntervalModule | ||
} from '@c8y/ngx-components'; | ||
|
||
@Component({ | ||
selector: 'tut-countdown-example', | ||
templateUrl: './countdown-example.component.html', | ||
standalone: true, | ||
imports: [CommonModule, CountdownIntervalModule] | ||
}) | ||
export class CountdownExampleComponent implements AfterViewInit { | ||
@ViewChild(CountdownIntervalComponent) | ||
countdownIntervalComponent: CountdownIntervalComponent; | ||
|
||
ngAfterViewInit(): void { | ||
this.startCountdown(); // We need to start the countdown at some point, for example, in AfterViewInit | ||
} | ||
|
||
startCountdown(): void { | ||
this.countdownIntervalComponent.start(); | ||
} | ||
|
||
stopCountdown(): void { | ||
this.countdownIntervalComponent.stop(); | ||
} | ||
|
||
stopCountdownAtZero(): void { | ||
this.countdownIntervalComponent.stop(true); | ||
} | ||
|
||
resetCountdown(): void { | ||
this.countdownIntervalComponent.reset(); | ||
} | ||
|
||
onCountdownEnded(): void { | ||
console.log('Countdown Ended!'); | ||
|
||
this.resetCountdown(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components'; | ||
|
||
@NgModule({ | ||
providers: [ | ||
hookRoute({ | ||
path: 'help', | ||
loadComponent: () => | ||
import('./countdown-example.component').then(m => m.CountdownExampleComponent) | ||
}), | ||
hookNavigator( | ||
new NavigatorNode({ | ||
path: '/countdown', | ||
label: 'Countdown', | ||
icon: 'hand-o-right', | ||
priority: 110 | ||
}) | ||
) | ||
] | ||
}) | ||
export class CountdownExampleModule {} |