Reputation: 9043
Am having difficulties getting this date picker to work.
included the javascript files
<script src="js/ui-bootstrap.js"></script>
<script src="js/ui-bootstrap-tpls.js"></script>
in the index page
in my app project file I inject it
var testing = angular.module("testing", ["common.services", "ui.router", "ui.bootstrap"]);
markup
<span class="input-group-btn">
<button type="button" class="btn btn-default" is-open="opened" datepicker-popup="yyyy" ng-click="open1($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
main controller
angular.module("testing").controller("MainController", ["$scope", MainController]);
function MainController($scope) {
$scope.opened = false;
$scope.open1 = function ($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = !$scope.opened;
};
}
but nothing is happening.
What am I missing?
Thanks
Upvotes: 0
Views: 693
Reputation: 3797
Whether you mentioned your complete markup or If this is your complete markup then it is wrong. This is what I use:
<input type="text" class="" uib-datepicker-popup="dd-MMMM-yyyy" ng-model="startDate" min-date="minDate" max-date="cmaxDate" show-button-bar="false" show-weeks="false" is-open="isStartDatePickerOpen" required readonly/>
<span class="input-group-btn">
<button type="button" class="btn btn-default inline" ng-click="startDatePickerToggle()"><i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
Controller:
$scope.startDatePickerToggle = function(){
$scope.isStartDatePickerOpen = true;
};
Upvotes: 1