katemihalikova / ion-datetime-picker

Date and/or time picker for awesome Ionic framework
MIT License
168 stars 101 forks source link

Integration with Angular-Formly #26

Closed chrisvor closed 8 years ago

chrisvor commented 8 years ago

I'm trying to use your excellent component within a custom template in Angular-Formly but I can't do it. I'm not sure what I should call on the "onclick" event to show your component. Any suggestions? (seasoned developer but very new to both Ionic and Angular-Formly :) )

Thanks !

katemihalikova commented 8 years ago

Hi Christos, I'm not familiar with Angular-Formly at all, but this may help you:

Current version of the picker uses isolated scope to store its methods. You can access that scope if you have reference to the element with the ion-datetime-pickerdirective. From here, you can simply call .showPopup() method.

angular.element(PICKER_ELEMENT).isolateScope().showPopup();

The directive also adds a click handler to the element itself so you can also use that with some kind of event bubbling.