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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ Make sure you use `charset="utf-8"` in your script tag if your browser (or those
To use the directive, use the following code :

```html
<input type="text" ng-datepicker ng-options="datepickerOptions" ng-model="date">
<input type="text" ng-datepicker oi-options="datepickerOptions" ng-model="date">
```

`ng-datepicker` : Indicates you want your input as a date picker.

`ng-options` : Object of the controller scope containing the [options](http://bootstrap-datepicker.readthedocs.org/en/latest/options.html) for your date picker.
`oi-options` : Object of the controller scope containing the [options](http://bootstrap-datepicker.readthedocs.org/en/latest/options.html) for your date picker.

`ng-model` : Variable of the controller scope to store the date. The date is currently store as a string, formatted according to the one set in ng-options.
`ng-model` : Variable of the controller scope to store the date. The date is currently store as a string, formatted according to the one set in oi-options.


For a working example, see https://github.com/cletourneau/angular-bootstrap-datepicker/blob/master/example/demo.html
8 changes: 4 additions & 4 deletions example/angular-bootstrap-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2095,18 +2095,18 @@ dp.directive('ngDatepicker', function() {
restrict: 'A',
replace: true,
scope: {
ngOptions: '=',
oiOptions: '=',
ngModel: '='
},
template: "<div class=\"input-append date\">\n <input type=\"text\"><span class=\"add-on\"><i class=\"icon-th\"></i></span>\n</div>",
link: function(scope, element) {
scope.inputHasFocus = false;
element.datepicker(scope.ngOptions).on('changeDate', function(e) {
element.datepicker(scope.oiOptions).on('changeDate', function(e) {
var defaultFormat, defaultLanguage, format, language;
defaultFormat = $.fn.datepicker.defaults.format;
format = scope.ngOptions.format || defaultFormat;
format = scope.oiOptions.format || defaultFormat;
defaultLanguage = $.fn.datepicker.defaults.language;
language = scope.ngOptions.language || defaultLanguage;
language = scope.oiOptions.language || defaultLanguage;
return scope.$apply(function() {
return scope.ngModel = $.fn.datepicker.DPGlobal.formatDate(e.date, format, language);
});
Expand Down
Loading