Hi everyone, I have a simple directive that binds the datepicker object. I
have a working JSFiddle: http://jsfiddle.net/mikemahony/jdz0vvkv/ but when
I use this same code inside my application nothing happens--no datepicker
and no errors. Now, I suspect this has to do with scoping because I know
ng-view creates a child scope. Right now I have this as my directive:
JBenchApp.directive('jqdatepicker', function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
element.datepicker({
dateFormat: 'DD, d MM, yy',
onSelect: function (date) {
scope.date = date;
scope.$apply();
}
});
}
};
});
and this is in my view (partial):
<input type="text" ng-model="date" jdatepicker />
I suspect that this has to do with the scope. How can I insure that this
works with the object in the partial?
--
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.