The Nativescript Timepicker documentation says I can use both loaded and timeChange events in order to inteact with the dates.
However I need to get the time just when the user press a submit button. Can you give me some guidelines for achieve this? I've using @ViewChild for getting the Element by reference although seems not to be the right way to do it.
You can use @ViewChild to get a reference to your TimePicker and read the current time values. Still, if you prefer, you could also directly use the native
loadedevent to achieve the same thing.Example with using a reference from the
loadedeventtime-picker.component.html
time-picker.component.ts
Playground demo for the above scenario.
Another possibility is to get the reference via getViewById and with Page DI.
Example for using Page dependency injection.
time-picker.component.html
time-picker.component.ts
Playground demo for the above example