Search code examples
angularcordovaionic-frameworkcalendarcordova-plugins

ionic Cordova is not available


i am using ionic native calendar in ionic 3.9.2 ,i have already installed and included the module in the app module , here is the code where i am calling the calendar :


import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Calendar } from '@ionic-native/calendar';

@IonicPage()
@Component({
  selector: 'page-evenements',
  templateUrl: 'evenements.html',
})
export class EvenementsPage {

  constructor(public navCtrl: NavController, public navParams: NavParams,private calendar: Calendar) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad EvenementsPage');
    this.calendar.createCalendar('MyCalendar').then(
      (msg) => { console.log(msg); },
      (err) => { console.log(err); }
    );
  }

}

the page is empty and the calendar is not being displayed and this is my console log :

Native: tried calling Calendar.createCalendar, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
util.js (66,1)

cordova_not_available

Notice : i am running the app on a web browser


Solution

  • you can build it on the browser using the command: ionic cordova run browser

    some of the plugins are compatible with browsers you can check here to see the compatibility of each plugin in the left-hand side menu: https://ionicframework.com/docs/native