mdPickers icon indicating copy to clipboard operation
mdPickers copied to clipboard

self.date is undefined

Open vidazoo-deployer opened this issue 9 years ago • 9 comments

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

vidazoo-deployer avatar Dec 12 '16 09:12 vidazoo-deployer

Sale versions, same issue...

LouisMazel avatar Dec 12 '16 15:12 LouisMazel

Same issue

andrea-vega avatar Dec 12 '16 20:12 andrea-vega

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 avatar Dec 14 '16 19:12 andrea-vega

https://github.com/alenaksu/mdPickers/pull/168 Fixes

andrea-vega avatar Dec 14 '16 20:12 andrea-vega

same here

danieloprado avatar Dec 22 '16 11:12 danieloprado

@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 :)

felipegouveiae avatar Jan 05 '17 23:01 felipegouveiae

@felipegouveiae great! Glad to help :)

andrea-vega avatar Jan 06 '17 14:01 andrea-vega

Great Thank you very much.

softsara avatar Feb 25 '17 05:02 softsara

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!

mcblum avatar Apr 11 '17 14:04 mcblum