Hi, i have a problem with this code:
import { Component } from ‘@angular/core’;
import { NavController, ToastController } from ‘ionic-angular’;
import { Diagnostic } from ‘@ionic-native’;
import { CameraPreview, CameraPreviewRect } from ‘ionic-native’;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
constructor(public navCtrl: NavController,
public toastCtrl: ToastController ) {
this.checkPermissions();
}
checkPermissions() {
Diagnostic.isCameraAuthorized().then((authorized) => {
if(authorized)
this.initializePreview();
else {
Diagnostic.requestCameraAuthorization().then((status) => {
if(status == Diagnostic.permissionStatus.GRANTED)
this.initializePreview();
else {
// Permissions not granted
// Therefore, create and present toast
this.toastCtrl.create(
{
message: “Cannot access camera”,
position: “bottom”,
duration: 5000
}
).present();
}
});
}
});
}
}
give me 2 errors:
[error] typescript: src/pages/home/home.ts, line: 21
Property ‘initializePreview’ does not exist on type ‘HomePage’.
L20: if(authorized)
L21: this.initializePreview();
L22: else {
[error] typescript: src/pages/home/home.ts, line: 25
Property ‘initializePreview’ does not exist on type ‘HomePage’.
L24: if(status == Diagnostic.permissionStatus.GRANTED)
L25: this.initializePreview();
L26: else {
thanks.