Skip to content
This repository was archived by the owner on Oct 29, 2018. It is now read-only.

Commit 7b59da0

Browse files
Added comments, tidied things up a little
1 parent 43fcd39 commit 7b59da0

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

angular-timezone-selector.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
/*global angular, _, moment, $*/
2+
3+
/**
4+
* angular-timezone-selector
5+
*
6+
* A simple directive that allows a user to pick their timezone
7+
*
8+
* Author: Ashok Fernandez <[email protected]>
9+
* Date: 12/06/2015
10+
* License: MIT
11+
*/
12+
213
angular.module('angular-timezone-selector', [])
314
.constant('_', _)
415
.constant('moment', moment)
@@ -13,7 +24,10 @@ angular.module('angular-timezone-selector', [])
1324
})
1425
return timezoneMap
1526
}])
27+
28+
// Timezone name to country codemap
1629
.factory('zoneToCC', ['_', function (_) {
30+
// Note: zones is populated with the data from 'data/zone.csv' when this file is built
1731
var zones = []
1832
var zoneMap = {}
1933
_.forEach(zones, function (zone) {
@@ -22,20 +36,23 @@ angular.module('angular-timezone-selector', [])
2236
return zoneMap
2337

2438
}])
39+
40+
// Country code to country name map
2541
.factory('CCToCountryName', ['_', function (_) {
42+
// Note: codes is populated with the data from 'data/cca2_to_country_name.csv' when this file is built
2643
var codes = []
2744
var codeMap = {}
2845
_.forEach(codes, function (code) {
2946
codeMap[code.cca2] = code.name
3047
})
3148
return codeMap
3249
}])
50+
3351
.directive('timezoneSelector', ['_', 'timezones', 'zoneToCC', 'CCToCountryName', function (_, timezones, zoneToCC, CCToCountryName) {
3452
return {
3553
restrict: 'E',
3654
replace: true,
3755
template: '<select style="min-width:300px;"></select>',
38-
// require: 'ngModel',
3956
scope: {
4057
ngModel: '='
4158
},

0 commit comments

Comments
 (0)