0
I would like to use the device camera but I’m finding it difficult
In my file list.ts
is just:
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
constructor(public navCtrl: NavController,
public navParams: NavParams,
public http: Http,
public toastCtrl: ToastController,
public camera: Camera) {
}
getFoto(){
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}
this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL):
let base64Image = 'data:image/jpeg;base64,' + imageData;
this.beer.img = base64Image;
}, (err) => {
console.log(err);
});
}
I also imported in app.module
in the preview
import { Camera } from '@ionic-native/camera/ngx';
...
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
Camera
]
Following this documentation, but gave this problem here:
How can I solve?
Here is my project in git.
Hey, try looking at this topic: https://answall.com/questions/91242/abrir-camera-dentro-de-umadiv-ionic, if you do not have access to documentation regarding your question: https://ionicframework.com/docs/native/camera/
– Thalles Rangel
Yeah. With the documentation did not solve and this other is in angular 1 right?
– adventistaam
says the tags it is in Ionic.
– Thalles Rangel
but Ionic uses angular and angular of that is not 4
– adventistaam