hsuanxyz / ion2-calendar

📅 A date picker components for ionic2 /ionic3 / ionic4
https://hsuanxyz.github.io/demo/ion2-calendar/
MIT License
555 stars 278 forks source link

Events not triggering #218

Closed idanzapp closed 5 years ago

idanzapp commented 5 years ago

Ionic version: (check one with "x") [ ] 2.x [ ] 3.x [ x ] 4.x

Ion2-calendar mode: (check one with "x") [ x ] components mode [ ] modal mode

I'm submitting a ... (check one with "x") [ x ] bug report [ ] feature request [ ] help me

Current behavior:

When I click a day, the event is not triggering

Expected behavior:

When I click a day, the event triggers

Steps to reproduce:

Just use the basic configuration o the lastest ionic 4 build

Related code:

<ion-calendar 
        (onSelect)="select($event)"
              [type]="type"
              [format]="'DD-MM-YYYY'">
    </ion-calendar> 
type: 'string' | 'js-date' | 'moment' | 'time' | 'object' = 'string'

  constructor() { } 

  select(event) {
    console.log('hi', event)
  }

Other information: Before clicking, nothing appears on console (expected)

start

After cicking, nothing appears on console (expected behaviour: ' hi [dateArray]') selected

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Ionic:

   ionic (Ionic CLI)             : 4.8.0 (C:\Users\Samir\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.2
   @angular-devkit/build-angular : 0.12.2
   @angular-devkit/schematics    : 7.2.2
   @angular/cli                  : 7.2.2
   @ionic/angular-toolkit        : not installed

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.0.0, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.1.4, (and 5 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\Samir\AppData\Local\Android\Sdk)
   NodeJS            : v10.9.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.5.0
   OS                : Windows 10
idanzapp commented 5 years ago

Finally, at least in ionic 4, the events are without the on (onSelect) should be (select)

ulesta commented 5 years ago

@idanzapp yep! Haven't gotten around to updating the docs, but I'll be updating them over the weekend to reflect this. As per Angular styleguide, we shouldn't prefix output bindings with on: https://angular.io/guide/styleguide#style-05-16

Sorry for the confusion! 😄