0

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

1
  • Where is your ng-model? Commented Jun 1, 2016 at 10:35

1 Answer 1

1

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;
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.