ng.clock

0.1.0 • Public • Published

ng.clock

AngularJS 1.X clock module with customisable circular analogue and digital clock

Getting started

First You need to install the ng.clock module as a dependency for Your project via npm:

npm i -s ng.clock

Second You need to add AngularJS 1.X and ng.clock references to Your project:

<script src="node_modules/angular/angular.js"></script>
<script src="node_modules/ng.clock/index.js"></script>

Third You need to simply add the ng.clock module as a dependency to Your app:

angular.module('myApp', ['ng.clock'])

Then You can finally use the directives to add either the analogue clock or the digital clock to Your project:

<digital-clock></digital-clock>
<!-- or -->
<analog-clock></analog-clock>

Customising

Both of these directives have some attributes to modify them with to Your liking

The digital clock

By default the digital clock has only hours and minutes displayed and the colon in beteen them is used to reference the seconds passing by blinking.

If You want to also display the seconds as numbers, set the seconds attribute true:

<digital-clock seconds="true"></digital-clock>

This will stop the colon blinking and instead will append the seconds to the end.

The analogue clock

By default the analogue clock has only hours and minutes hands visible and the default color for everything is black.

You can change the colors of each of the hands and the number dots separately with hour-color, min-color, sec-color and num-color.

<analog-clock hour-color="blue" min-color="#aabbcc" sec-color="red" num-color=""green></analog-clock>

You could also change both main hands colors at the same time with main-hands-color.

<analog-clock main-hands-color="navy" sec-color="red"></analog-clock>

Also You could turn the seconds hand on by setting the attribute sec-hand

<analog-clock sec-hand="true"></analog-clock>

The seconds hand is turned on by either the parameter sec-hand or by setting the color for the seconds hand with sec-color.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i ng.clock

    Weekly Downloads

    3

    Version

    0.1.0

    License

    GPL-3.0

    Last publish

    Collaborators

    • tonister