angular8-countdown-timer
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

angular8-countdown-timer

This library was created because no simple countdown timer was available that would work with Angular's AOT compiler.

Installation

To install this library, run:

npm install angular8-countdown-timer --save

Use within your module

Add the following lines to your angular module:

import {NgModule} from '@angular/core';
 
// Import the Countdown timer module
import {AngularCountdowntimerModule} from 'angular-countdowntimer';
 
@NgModule({
    imports: [
        AngularCountdowntimerModule
    ]
})
export class YourModule {
}

Usage within your component:

import { Component } from '@angular/core';
 
@Component({
    selector: 'app-your',
    templateUrl: './your.component.html',
    styleUrls: [ './your.component.css' ]
})
export class YourComponent  {
    someDate: Date;
 
    ngOnInit() {
        // set a date for 14 minutes and 12 seconds from now
        this.someDate = new Date( Date.now() + (14 * 60 + 12) * 1000 );
    }
 
    myTriggerFunction() {
        console.log('triggered!');
    }
}

Usage within your template:

<h1>This is a title</h1>
 
<p>
    Without always showing hours:
    <countdown-timer [endDate]="someDate" (zeroTrigger)="myTriggerFunction()"></countdown-timer>
</p>
 
<p>
    With always showing hours:
    <countdown-timer [endDate]="someDate" [alwaysShowHours]="true"></countdown-timer>
</p>

Readme

Keywords

none

Package Sidebar

Install

npm i angular8-countdown-timer

Weekly Downloads

6

Version

1.0.0

License

none

Unpacked Size

62.5 kB

Total Files

26

Last publish

Collaborators

  • danieleisenhardt