Guys i created following directive to use as a date picker component. if i
use two date pickers using this, when i select a date from one date picker
its reflects to the other
date picker scope. But In the view date will be display correctly.
//HTML
<date-picker ng-model="drexp" dtype="{{drexp}}" ></date-picker>
<date-picker ng-model="bday" dtype="{{bday}}" ></date-picker>
//angular snippet
`template: '<div class="">' +
'<input class="form-control form-control-inline input-medium date-picker"
size="16" type="text" value="">' +
'<span class="help-block"> Provide employee Birthday</span>' +
'</div>',
restrict: 'E',
scope: { },
require: 'ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
angular.element('.date-picker').datepicker().on('changeDate',
function (e) {
ngModelCtrl.$setViewValue(e.date);
scope.$apply();
});
}
};
<https://lh3.googleusercontent.com/-UIn5gVqcnUc/V7jB83lx3fI/AAAAAAAACC8/1q4ML-JC-vYwAidRUIwKSPrEISgIBi1vQCLcB/s1600/gitter.PNG>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.