Giter Site home page Giter Site logo

angular-material-timepicker's Introduction

material-timepicker

Lightweight Angular.js directive, Material Design compliant and customizable using SASS variables.

Index

Demo

Live demo on CodePen.
Example also included in examples folder. After downloading the repository, browse to the examples folder, open a command prompt and type:

node server

Make sure to have Node.js installed on your machine.

How to install

You can clone the current repository:

git clone https://github.com/MasterDaveh/angular-material-timepicker.git

How to get started

You can check out the example as mentioned in the Demo Section. You will need to include material-timepicker.js, tmpicker.css and material-timepicker.html in your project.
Note that this package depends on Angular.js and Moment.js.

1. Resolve the dependencies

To do so using npm run

npm install angular

and

npm install moment

To use npm you will also need to have Node.js installed.
If you prefer to use a CDN just copy these script tags:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>

and include them in your page.

2. Include the directive

Make sure to have loaded the material-timepicker.js, tmpicker.css and material-timepicker.html files also.
The directive is an HTML element so you will include it as follows:

<material-timepicker model="model" url="template/material-timepicker.html"></material-timepicker>

The model attribute is the variable the selected hour will be tied to.
The url attribute is the path to the material-timepicker.html file, so that it can be injected into the directive.

You will also need to inject the directive module in your module to make it available. Include the module name into the array of dependencies of your angular module:

angular.module('exampleApp', ['material.timepicker'])

Finally, create a model for the timepicker in the controller that your directive is included into

.controller('mainCtrl', function($scope) {
  $scope.model = moment(); // the model needs to be a moment value
});

Contact me

If you find bugs feel free to open an issue and/or send a pull request.
If you feel something is not clear, or the documentation needs to be updated send me a DM on Twitter or on Facebook

References

This directive was inspired by sidaudhi's work on the circular timepicker directive.

License

The MIT License (MIT)

Copyright (c) 2016 Masterdaveh

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

angular-material-timepicker's People

Contributors

masterdaveh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.