diosney / angular-bootstrap-datetimepicker-directive

A wrapper directive around the bootstrap-datetimepicker component.
MIT License
69 stars 50 forks source link

Undefined is not a function #1

Closed ssedwards1 closed 9 years ago

ssedwards1 commented 9 years ago

Hi

I've tried to follow the guild for the Angular wrapper but I get the following when trying to implement the Minimal Setup.

TypeError: undefined is not a function
at link (http://changebg-ssedwards1.c9.io/bower_components/angular-bootstrap-datetimepicker-directive/angular-bootstrap-datetimepicker-directive.js:48:14)

The is the injection in to the APP

var app = angular.module('richApp', ['ngResource', 'ngAnimate', 'restangular', 'datetimepicker'])
.config(function(RestangularProvider, datetimepickerProvider) {
            RestangularProvider.setBaseUrl('api/');
            RestangularProvider.setRestangularFields({id: "_id"});
            datetimepickerProvider.setOptions({locale: 'en'});
        })
.run(['$rootScope',function ($rootScope) {
            $rootScope.scoped = {format: 'HH:mm:ss'};
            }
        ]);
diosney commented 9 years ago

Hi, thanks for trying the wrapper and sorry for the delay, I haven't an available network connection in the past days.

The line 48 reads:

.datetimepicker(options);

So it seems that you didn't included the real jquery bootstrap datetimepicker plugin, like this:

<script type="text/javascript" src="bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>

Refer to the official guide and reopen the issue if this wasn't the solution.

gpempro commented 9 years ago

I also had to add $element = $($element[0]); in the link method of the directive for it to work.

(using jQuery 2.3.1 if it can be any indication)