How to use cordova plugin


#1

I am trying this as the example but it is not working

import { Sim } from 'ionic-native';

@Component({
  selector: 'page',
  templateUrl: 'page.html'
})

export class page {

  constructor(public navCtrl: NavController ) { }

  sim() {
    sim.getSimInfo().then(
      (info) => console.log('Sim info: ', info),
      (err) => console.log('Unable to get sim info: ', err)
     );
  }

}

I’m getting this error:

';' expected. 

   sim.getSimInfo().then(
    (info) => console.log('Sim info: ', info),

Declaration or statement expected.
Function implementation is missing or not immediately following the declaration.

How does this plugin works


#2

I believe your error lies elsewhere, as I pasted what you gave into a scratch project and it built fine.