HI everybody, I’m new to Ionic and trying to build my first app as from here: Build Camera API for iOS, Android & Web | Ionic Capacitor Camera.
I first got an error in services/photo.service.ts
and solved it modifying:
public async addNewToGallery() {
to
const addNewToGallery = async() => {
But next I can’t fix this error in tab2.page.ts
:
./src/app/tab2/tab2.page.ts - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/src/tools/babel/webpack-loader.js):
[ng] SyntaxError: B:\Programming\VisualStudio\Ionic\photo-gallery\src\app\tab2\tab2.page.ts: Unexpected reserved word 'public'. (7:12)
[ng]
[ng] 5 | import * as i1 from "../services/photo.service";
[ng] 6 | import * as i2 from "@ionic/angular";
[ng] > 7 | constructor(public, photoService, PhotoService);
[ng] | ^
[ng] 8 | { }
[ng] 9 | addPhotoToGallery();
[ng] 10 | {
and many other following errors depending on the first one (I guess…).
My services/photo.service.ts
code is the following:
import { Component } from '@angular/core';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from '../explore-container/explore-container.component';
import { PhotoService } from '../services/photo.service';
constructor(public photoService: PhotoService) {}
addPhotoToGallery() {
this.photoService.addNewToGallery();
}
@Component({
selector: 'app-tab2',
templateUrl: 'tab2.page.html',
styleUrls: ['tab2.page.scss'],
standalone: true,
imports: [IonicModule, ExploreContainerComponent]
})
export class Tab2Page {
constructor(public photoService: PhotoService) { }
}
Please, may anyone help?
Thanks in advance.