Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ angular-pickadate.js

Angularjs extension for the slick date/time picker, [pickadate.js by Amsul](http://amsul.ca/pickadate.js/)

The use is very simple once you include this directive:
Add the module as a dependency to your application module:

```js
var myAppModule = angular.module('MyApp', ['ngDatePicker'])
```

The use is very simple once you add the dependency:

<input type="text" pick-a-date="curDate" />
<input type="text" pick-a-time="curDate" />
Expand Down
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html >
<html>
<head>
<title>AngularJS pickadate.js directive</title>
<link rel="stylesheet" type="text/css" href="pickadate/themes/default.css" />
Expand All @@ -14,9 +14,10 @@
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body ng-app>
<body ng-app="MyApp">

<h1>Pick date and time</h1>
<div>
<div ng-controller="testController">
Date: <input type="text" pick-a-date="curDate" /><br/>
Time: <input type="text" pick-a-time="curDate" /><br/>
Expand All @@ -41,5 +42,6 @@ <h1>Options</h1>
Time: <input type="text" pick-a-time="curDate" pick-a-time-options="{ format: 'HH:i', selectYears: true }" /><br/>
Result: <span>{{ curDate | date:'medium' }}</span><br/>
</div>
</div>
</body>
</html>
29 changes: 16 additions & 13 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// pick-a-date (attribute)
angular.module('ng').directive('pickADate', function () {
var ngDatePicker = angular.module('ngDatePicker', []);
ngDatePicker.directive('pickADate', function () {
return {
restrict: "A",
scope: {
Expand Down Expand Up @@ -65,7 +66,7 @@ angular.module('ng').directive('pickADate', function () {
});

// pick-a-time (attribute)
angular.module('ng').directive('pickATime', function () {
ngDatePicker.directive('pickATime', function () {
return {
restrict: "A",
scope: {
Expand Down Expand Up @@ -120,20 +121,22 @@ angular.module('ng').directive('pickATime', function () {
};
});

//--------- other misc shit ---------------
//--------- other misc stuff ---------------

function testController($scope) {
(function () {
'use strict';
angular.module('MyApp', ['ngDatePicker'])
.controller('testController', function ($scope) {
$scope.curDate = '';
$scope.newDate = function() {
return new Date();
$scope.newDate = function () {
return new Date();
};
}

function testController2($scope) {
})
.controller('testController2', function ($scope) {
$scope.startDate = '2014-02-24 12:00:00';
$scope.endDate = '2014-02-27 12:00:00';
}

function testController3($scope) {
})
.controller('testController3', function ($scope) {
$scope.curDate = '2014-02-24 12:00:00';
}
})
})();