From 369d5ac1ef27591de3cb9c5008f1f72e24f6316c Mon Sep 17 00:00:00 2001 From: Piotrek Date: Thu, 3 Oct 2013 13:56:44 +0200 Subject: [PATCH] working my way up to angular 1.2 --- app/index.html | 128 +++++++++++++++++----------------- app/scripts/module.js | 13 ++-- app/templates/datepicker.html | 6 +- bower.json | 12 ++-- 4 files changed, 83 insertions(+), 76 deletions(-) diff --git a/app/index.html b/app/index.html index 3a6be09..89ef06e 100644 --- a/app/index.html +++ b/app/index.html @@ -1,51 +1,51 @@ - - - - - - - - - + + + + + + + + +
-
-

Calendar

+
+

Calendar

-

views

-
default
-
<div date-picker="start"></div> 
-
-
year
-
<div date-picker="start"  year></div> 
-
-
month
-
<div date-picker="start month></div> 
-
-
date
-
<div date-picker="start" date></div> 
-
-
hours
-
<div date-picker="start" hours></div> 
-
-
minutes
-
<div date-picker="start" minutes></div> 
-
-
-
-

Input

-
default
-
<input type="datetime" ng-model="model" date-time></div> 
- -
Input format
-
<input type="datetime" ng-model="model" date-time format="long"></div> 
- -
A button
+

views

+
default
+
<div date-picker="start"></div> 
+
+
year
+
<div date-picker="start"  year></div> 
+
+
month
+
<div date-picker="start month></div> 
+
+
date
+
<div date-picker="start" date></div> 
+
+
hours
+
<div date-picker="start" hours></div> 
+
+
minutes
+
<div date-picker="start" minutes></div> 
+
+
+
+

Input

+
default
+
<input type="datetime" ng-model="model" date-time></div> 
+ +
Input format
+
<input type="datetime" ng-model="model" date-time format="long"></div> 
+ +
A button
<div class="dropdown">
   <a class="dropdown-toggle btn btn-danger">
     pick a date: {{(date|date)}}
@@ -54,40 +54,40 @@
     <div date-picker="date" class="datetimepicker"></div>
   </div>
 </div>
- +
Date range
+
<div date-range start="start" end="end" ></div> 
+
+
Date range button
+ + +
- + diff --git a/app/scripts/module.js b/app/scripts/module.js index 4df73cf..fa0a710 100644 --- a/app/scripts/module.js +++ b/app/scripts/module.js @@ -53,7 +53,6 @@ return weeks; } - function getVisibleYears(date) { var years = []; date = new Date(date || new Date()); @@ -355,8 +354,7 @@ }); }, - transclude : true, - replace : true, + replace:true, templateUrl: 'templates/datepicker.html' }; }); @@ -378,6 +376,13 @@ } } + + scope.$watch(''+attrs.ngModel+'.getTime()',function(a,b){ + if(a!=b){ + ngModel.$setViewValue(a); + } + }); + function formatter(value) { return dateFilter(value, format); } @@ -433,4 +438,4 @@ } }; }); -})(angular); \ No newline at end of file +})(angular); diff --git a/app/templates/datepicker.html b/app/templates/datepicker.html index d2b7bd9..2c4fe30 100644 --- a/app/templates/datepicker.html +++ b/app/templates/datepicker.html @@ -1,4 +1,5 @@ -
+
+
@@ -122,4 +123,5 @@
-
\ No newline at end of file +
+
diff --git a/bower.json b/bower.json index 6d4374c..4f25697 100644 --- a/bower.json +++ b/bower.json @@ -1,19 +1,19 @@ { "name": "angular-datepicker", - "main": ["module.min.js","date.min.css"], "license": "MIT", - "version": "0.0.1", + "version": "0.0.2", "ignore": [ ".gitignore","README.md" ], "dependencies": {}, "devDependencies": { - "angular-unstable": "latest", - "json3": "~3.2.4", - "es5-shim": "~2.0.8", + "angular": "1.2.0-rc.2", "jquery": "~2.0.2", "angular-mocks": "~1.0.5", "angular-scenario": "~1.0.5", "angular-bootstrap": "~0.3.0" + }, + "resolutions": { + "angular": "1.2.0-rc.2" } -} \ No newline at end of file +}