Search code examples
angularjsangularjs-directiveangular-strap

Cannot reproduce the datepicker example on AngularStrap


Here is the plunker

and I am trying to reproduce the example shown here

I do not see the same output, what is that I am missing?


Solution

  • You didn't specify the ng-app module name and you should be able to initialize the calender in the controller. So modify the template like this in order to link AngularJS modules:

    <html ng-app='angularjs-starter'>
    <body ng-controller="MainCtrl">
    

    In controller, do:

    var app = angular.module('angularjs-starter', ['$strap.directives']);
    app.controller('MainCtrl', function($scope, $window, $location) {
        $scope.datepicker = {date: new Date("2012-09-01T00:00:00.000Z")};
    });
    

    So you will be able to see the working calender though you may need to fix the css :)

    Demo