Skip to content

Provider for NgModel is no longer needed in @Directive() #57

Description

@mtnair

(I know this component was made for Ionic 4, though I encountered following problem with Ionic 5 and Angular 9; I don't know whether this still works with Ionic 4)

When using the directive to add the date picker to an ion-input, the input field doesn't update its value to the picked date.
It took me a while to find out why, it seems like the providers: [NgModel] option in the @Directive() decorator is the issue. When removing this line, the date picker works as expected. See: https://github.com/logisticinfotech/ionic4-datepicker/blob/master/projects/ionic4-datepicker/src/lib/li-ionic4-datepicker.directive.ts#L12

@Directive({
  selector: '[customIonicDatepicker]',
  exportAs: 'customIonicDatepicker',
  providers: [NgModel], // remove this line
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions