katemihalikova / ion-datetime-picker

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

Does not work with list item inner element #62

Closed paolorr closed 7 years ago

paolorr commented 7 years ago

I tried to attach the directive to a list item span but nothing happens

    <label class="item item-input item-stacked-label">
        <span class="input-label">Date Time</span>
        <span class="readonly-input" ion-datetime-picker ng-model="currentItem.dateTime">
            {{currentItem.dateTime | date: "dd/MM/yyyy HH:mm"}}
        </span>
    </label>

If I move the directive and ng-model to the list item it works but also popus if i click on the label

    <label class="item item-input item-stacked-label" ion-datetime-picker ng-model="currentItem.dateTime">
        <span class="input-label">Date Time</span>
        <span class="readonly-input">
            {{currentItem.dateTime | date: "dd/MM/yyyy HH:mm"}}
        </span>
    </label>
katemihalikova commented 7 years ago

Hi Paolo, I don't know why is the first example not working, everything seems OK, but only the datetime itself can be tappable.

The second one is better, it mimics the behaviour of native inputs, they are focused/opened even when tapped on the label. If you don't want that, you need to investigate the first example more.

paolorr commented 7 years ago

Hi Kate, I don't know too much of angular, so I can't debug that in depth. I noticed that the link property on the directive is called 2 times, one for each example, and the click event is attatched. Im stuck there, don't know why the second click event is not called.

BTW, I never noticed the behavior when clicking on the label. I just checked with atext input and works like that :) So, forget this issue....