Creating a Photo Gallery with Device Storage
Last time, we successfully added the Camera plugin to the Tab2 page of our Tabs app. Currently, the photo is replaced each time a new one is taken. What if we wanted to display multiple photos together? Let’s create a photo gallery. You can follow along with the complete code for this on GitHub.
Creating a Dedicated Photo Service
From a terminal window, navigate to your Ionic project and run:
ionic g service services/Photo
This creates a PhotoService class in a dedicated "services" folder:
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class PhotoService {
constructor() { }
}