Skip to content

Instantly share code, notes, and snippets.

@samarthagarwal
Last active September 29, 2018 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samarthagarwal/d465171fcaf62c5584a8bcc1f9cb3f0f to your computer and use it in GitHub Desktop.
Save samarthagarwal/d465171fcaf62c5584a8bcc1f9cb3f0f to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core'
import { Storage } from '@ionic/storage'
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
constructor(private storage: Storage){
// set a key/value
\!h storage.set('name', 'Max');
// Or to get a key/value pair
\!h storage.get('age').then((val) => {
\!h console.log('Your age is', val);
\!h });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment