angularjs - Angular UI Bootstrap - Datepicker show on button click without function -
angularjs - Angular UI Bootstrap - Datepicker show on button click without function -
i want show datepicker angular ui bootstrap library when 1 of next events occours:
user clicks in input box user clicks on calendar iconi know possible calling controller function when button clicked in illustration here
my question is: necessary create controller/scope method show datepicker?
the next illustration shows code:
class="snippet-code-js lang-js prettyprint-override">angular.module("mymodule", ["ui.bootstrap"]);
class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.11.2/ui-bootstrap-tpls.js"></script> <div ng-app="mymodule"> <div class="form-group"> <label for="birthdate" class="control-label col-sm-4">birthdate</label> <div class="col-sm-6"> <p class="input-group"> <input type="text" class="form-control" id="birthdate" ng-model="newemployee.birthdate" datepicker-popup="dd.mm.yyyy" is-open="opened" ng-click="opened=true"> <span class="input-group-btn"> <button type="button" class="btn btn-default" ng-click="opened=true"> <i class="glyphicon glyphicon-calendar"></i> </button> </span> </p> </div> </div> </div>
i found out possible prevent event propagation within ng-click code this:
class="snippet-code-js lang-js prettyprint-override">angular.module("mymodule", ["ui.bootstrap"]);
class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.11.2/ui-bootstrap-tpls.js"></script> <div ng-app="mymodule"> <div class="form-group"> <label for="birthdate" class="control-label col-sm-4">birthdate</label> <div class="col-sm-6"> <p class="input-group"> <input type="text" class="form-control" id="birthdate" ng-model="newemployee.birthdate" datepicker-popup="dd.mm.yyyy" is-open="opened" ng-click="opened=true"> <span class="input-group-btn"> <button type="button" class="btn btn-default" ng-click="opened=true;$event.stoppropagation();"> <i class="glyphicon glyphicon-calendar"></i> </button> </span> </p> </div> </div> </div>
angularjs twitter-bootstrap datepicker
Comments
Post a Comment