angularjs - Angular-Ui Bootstrap DatePicker Open on focus -


though may seem simple question, can't find anywhere solution.

simple this:

<input type="text" datepicker-popup> 

i want when cursor enters, calendar popup automatically shows up, jquery-ui datepicker. have either provide button or alt-down, both unfriendly me.

there is-open attribute dont want complicate things putting variables in scope should available configuration? :d.

thanks

edit:

i found solution. it's little tricky works. here directive:

app.directive("autoopen", ["$parse", function($parse) {   return {     link: function(scope, ielement, iattrs) {       var isolatedscope = ielement.isolatescope();       ielement.on("focus", function() {         isolatedscope.$apply(function() {           $parse("isopen").assign(isolatedscope, "true");         });       });     }   }; }]); 

and view:

<input type="text" datepicker-popup="" ng-model="ctrl.dt" auto-open /> 

this older solution:

you can write directive change value of is-open when input focuses:

app.directive("autoopen", ["$parse", function($parse) {   return {     link: function(scope, ielement, iattrs) {       var isopenvarname = iattrs.isopen;       ielement.on("focus", function() {         $scope.$apply(function() {           $parse(isopenvarname).assign(scope, "true");         });       });     }   }; }]); 

and here view:

  <input type="text" datepicker-popup="" auto-open is-open="open" ng-model="ctrl.dt" /> 

note that, have define open in controller , place is-open="open" in input element. know not best solution. make better find better solution.

update : @akos-lukacs mentioned in comments, solution not work when disabling debug data in angular.


Comments

Popular posts from this blog

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -