Kendo UI datepicker angular directive -
i have kendo ui datepicker angular directive in typescript. when place 2 directives on 1 page , comment line scope["ngmodel"] = _utc;
, works fine doesn't solve purpose. when uncomment line , select date in second directive, clears value of first calendar.
export class dateutcdirective { public static $inject: string[] = ["authservice", "propbagfilter"]; public constructor( authservice: services.authservice, propbagfilter: function ) { return <ng.idirective>{ restrict: "a", template: "<div>" + "<div class='input-group'>" + "<input kendo-date-picker k-ng-model='ngmodel' k-format='format' k-on-change='select()'/>" + "</div>" + "<div class='input-group' ng-show='istimeallowed' >" + "<br />" + "<input kendo-time-picker k-ng-model='ngmodel' />" + "</div>" + "</div>", replace: true, scope: { ngmodel: "=", paramobject: "=" }, link(scope: ng.iscope, element: any, attrs: any) { var propbag = propbagfilter(scope["paramobject"].props); var authpropbag = propbagfilter(authservice.currentuser.props); (<any>scope).select = function () { if (!!propbag["isutc"]) { console.log(scope); var localdate = new date(scope["ngmodel"]); var _utc = localdate.toutcstring(); scope["ngmodel"] = _utc; } } scope["istimeallowed"] = propbag["istimeallowed"] || false; scope["isutc"] = propbag["isutc"] || false; scope["format"] = authpropbag["shortdatepattern"]; } } } }
try giving id
<input kendo-time-picker k-ng-model='ngmodel' />
like
<input kendo-date-picker k-ng-model='ngmodel' k-format='format' k-on-change='select()' id="abc1"/> <input kendo-time-picker k-ng-model='ngmodel' id="abc2" />
Comments
Post a Comment