Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

Help with First App

$
0
0

I am struggling with the first app “photo-gallery” and would love some help!

import { Injectable } from '@angular/core';
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
import { Filesystem, Directory } from '@capacitor/filesystem';
import { Storage } from '@capacitor/storage';

public async addNewToGallery(){
  let capturedPhoto: Photo;
  capturedPhoto = await Camera.getPhoto({
    resultType: CameraResultType.Uri,
    source: CameraSource.Camera,
    quality: 100
  });
}

@Injectable({
  providedIn: 'root'
})

export class PhotoService {

  constructor() { }
}

My error I keep getting is this:
Error: src/app/services/photo.service.ts:6:1 - error TS1128: Declaration or statement expected.

6 public async addNewToGallery(){


Error: src/app/services/photo.service.ts:6:8 - error TS2304: Cannot find name 'async'.

6 public async addNewToGallery(){
       ~~~~~

Error: src/app/services/photo.service.ts:6:14 - error TS1005: ';' expected.

6 public async addNewToGallery(){
             ~~~~~~~~~~~~~~~

Error: src/app/services/photo.service.ts:6:14 - error TS2304: Cannot find name 'addNewToGallery'.

6 public async addNewToGallery(){
             ~~~~~~~~~~~~~~~

Error: src/app/services/photo.service.ts:6:31 - error TS1005: ';' expected.

6 public async addNewToGallery(){
                              ~
Error: src/app/tab2/tab2.page.ts:14:23 - error TS2339: Property 'addNewToGallery' does not exist on type 'PhotoService'.

14     this.photoService.addNewToGallery();

_________________________________________________

I've done everything pretty much cut and paste from the tutorial. Any thoughts?

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>