Input type datetime-local is undefined when submit the form

Hi everybody,
I have a problem with a datetime-local input type.
This is the html code:

<form ng-submit="submit()">
    <input type="datetime-local" required ng-model="passaggio.dataora">
    <button type="submit" class="button button-calm button-block">submit</button>
</form>

And this is the controller:

$scope.submit = function() {
    alert($scope.passaggio.dataora);
}

The problem is that I always get “undefined”, even if I put a value in the input.

Any helps?

Thanks

Have you declared $scope.passaggio before? Like this:

$scope.passaggio= {};

Or something similar (in this case it is a javascript object)
Hope it helps :smile:

Yes I did.

The $scope.passaggio is defined.

Well then. I don’t know if this will work, or if it is a ‘best practice’, but did you try doing something like:

<form ng-submit="submit(pasaggio.dataora)">

I never used ng-submit, i don’t have forms in my app, so i won’t be of too much help here…