Skip to content
This repository has been archived by the owner on May 12, 2018. It is now read-only.

self.date is undefined #166

Open
vidazoo-deployer opened this issue Dec 12, 2016 · 9 comments
Open

self.date is undefined #166

vidazoo-deployer opened this issue Dec 12, 2016 · 9 comments

Comments

@vidazoo-deployer
Copy link

On mdPickers.js line 241 self.date.daysInMonth() is throwing an error.
It seems like CalendarCtrl is not getting the values from datepicker (which is the alias of DatePickerCtrl).
I could make it work by adding self.date = $scope.$parent.datepicker.date in CalendarCtrl.

versions:
angular 1.6.0
angular-material 1.1.0
mdPickers 0.7.5
moment 2.17.1

@LouisMazel
Copy link

Sale versions, same issue...

@andrea-vega
Copy link

Same issue

@andrea-vega
Copy link

I believe the issue is a breaking change angular 1.6 made:
"Disabling (by default) the pre-assignment of bindings on controller instances, which helps with support for native ES6 classes."
https://docs.angularjs.org/guide/migration#migrate1.5to1.6-ng-services-$compile

All the logic that is currently in the constructor for the directive controllers needs to be moved into an $onInit function.

@andrea-vega
Copy link

andrea-vega commented Dec 14, 2016

#168 Fixes

@danieloprado
Copy link

same here

@felipegouveiae
Copy link

@danieloprado

I was able to temporary workarround installing the fork :

bower install -f --save https://github.com/andrea-vega/mdPickers.git#7c8f32fac12a01ad66e6728b603dcf8c7e86c0ce

@andrea-vega it worked like a charm. Thanks so much :)

@andrea-vega
Copy link

@felipegouveiae great! Glad to help :)

@softsara
Copy link

Great Thank you very much.

@mcblum
Copy link

mcblum commented Apr 11, 2017

Does anyone know if this fixes the time picker, too? I've got the following error:

TypeError: Cannot read property 'hours' of undefined
    at ClockCtrl.init (mdPickers.js:692)
    at new ClockCtrl (mdPickers.js:706)
    at Object.invoke (angular.js:5003)
    at $controllerInit (angular.js:10862)
    at nodeLinkFn (angular.js:9739)
    at compositeLinkFn (angular.js:9048)
    at publicLinkFn (angular.js:8913)
    at boundTranscludeFn (angular.js:9091)
    at Object.controllersBoundTransclude [as transclude] (angular.js:9858)
    at angular.js:31797

Line 692 is:
self.selected = self.time.hours() || 0;

Edit: It appears this is all the same thing. Hoping for an accepted pull request!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants