Count up timer for angular 17 this project is forked from main author [Yashvida](https://github.com/Y4SHVINE)
npm install ngx-timer-newbash
npm i ngx-timer-new --save
`
Usage
`ts
import { NgxTimerModule } from 'ngx-timer-new';
@NgModule({
imports: [
...
NgxTimerModule
],
})
`
$3
In html
`html
`
You can import CountupTimerService from ngx-timer-new to do the following functionalities.
1. To start the timer
`ts
this.countupTimerService.startTimer();
`
By passing a start time to above function timer will start from that.
eg :-
`ts
let cdate = new Date();
cdate.setHours(cdate.getHours()-2);
this.countupTimerService.startTimer(cdate);
`
2. To pause the timer
`ts
this.countupTimerService.pauseTimer();
`
3. To stop the timer
`ts
this.countupTimerService.stopTimer();
`
Configurations
Import countUpTimerConfigModel model from ngx-timer-new you will be able use following configurations.
`ts
import { countUpTimerConfigModel, timerTexts } from 'ngx-timer-new';
ngOnInit(): void {
//countUpTimerConfigModel
this.testConfig = new countUpTimerConfigModel();
//custom class
this.testConfig.timerClass = 'test_Timer_class';
//timer text values
this.testConfig.timerTexts = new timerTexts();
this.testConfig.timerTexts.hourText = "Hours"; //default - hh
this.testConfig.timerTexts.minuteText = "Minutes"; //default - mm
this.testConfig.timerTexts.secondsText = "Seconds"; //default - ss
}
`
$3
In html
`html
`
You can import CountdownTimerService from ngx-timer-new to do the following functionalities.
1.To start the timer
`ts
let cdate = new Date();
cdate.setHours(cdate.getHours() + 2);
this.CountdownTimerService.startTimer(cdate);
`
2.To pause the timer
`ts
this.CountdownTimerService.pauseTimer();
`
3.To stop the timer
`ts
this.CountdownTimerService.stopTimer();
`
3.To resume the timer
`ts
this.CountdownTimerService.resumeTimer();
`
Configurations
Import countUpTimerConfigModel model from ngx-timer-new you will be able use following configurations.
`ts
import { countDownTimerConfigModel, countDownTimerTexts } from 'ngx-timer-new';
ngOnInit(): void {
//countUpTimerConfigModel
this.testConfig = new countDownTimerConfigModel();
//custom class
this.testConfig.timerClass = 'test_Timer_class';
//timer text values
this.testConfig.timerTexts = new countDownTimerTexts();
this.testConfig.timerTexts.hourText = "Hours"; //default - hh
this.testConfig.timerTexts.minuteText = "Minutes"; //default - mm
this.testConfig.timerTexts.secondsText = "Seconds"; //default - ss
}
``