- Ionic 4 app to Create, Read, Update and Delete notes. Notes are stored and retrieved using the Ionic Storage component.
- Part 2: NgRX added for state management.
- Note: to open web links in a new window use: ctrl+click on link
- This app only has 2 pages:
- Home page with a list of note titles
- Detail page with a text area so note details can be added and changed. The entire note can also be deleted from this page.
- Ionic framework v4.
- Ionic CLI v7.
- Angular 7.
- Ionic Storage v2, a simple key-value module with SQLite.
- rxjs v6
- ngrx/effects v7 use streams to provide new sources of actions to reduce state based on external interactions such as network requests, web socket messages and time-based events.
- Install dependencies with npm install.
- Run app using
ionic serve
then navigate tohttp://localhost:8100/
. - The colour scheme can be changed by updating the ./theme/variables.scss file. Use the Ionic Colour Generator.
For dependency error: 'ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.1 was found instead': Solution: npm i typescript@3.1.6 --save-dev --save-exact.
For dependency error: 'Module not found: Error: Can't resolve 'core-js/es7/reflect'':
Solution: Add this to the tsconfig.json
file:
"paths": {
"core-js/es7/reflect": ["node_modules/core-js/proposals/reflect-metadata"],
"core-js/es6/*": ["node_modules/core-js/es/*"]
}
- Detail page showing the Ionic components
<ion-header>
<ion-toolbar color="tertiary">
<ion-buttons slot="start">
<ion-back-button defaultHref="/notes"></ion-back-button>
</ion-buttons>
<ion-title>{{ note.title }}</ion-title>
<ion-buttons slot="end">
<ion-button (click)="deleteNote()">
<ion-icon slot="icon-only" name="trash"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<!-- ngModel used for 2-way data-binding to update the content
property of the note with any change in the <ion-textarea> value -->
<ion-content padding>
<ion-textarea
(input)="noteChanged()"
[(ngModel)]="note.content"
placeholder="...something noteworthy?">
</ion-textarea>
</ion-content>
- A simple notepad application that uses many Ionic/Angular/Typescript core concepts such as:
- Navigation/Routing
- Templates
- Two-way data binding
- Interpolations
- Event binding
- Types and Interfaces
- Services
- Data Input
- Data Storage
- Styling
- NgRX observables
- This app allows the user to:
- create, delete, and edit notes
- Save and load those notes from storage
- View a list of notes
- View note details
- The ionic template default colors can be changed to:
- primary
- secondary
- tertiary
- light
- danger
- dark
- Status: Working
- To-Do: add delete function to Home page. Add a createdAt date. Consider a theme change button to change colors.
- JOSH MORONY's Ionic Tutorial part 1: Building a Notepad Application from Scratch with Ionic.
- JOSH MORONY's Ionic Tutorial part 2: Using NgRx for State Management in an Ionic & Angular Application
- JOSH MORONY's Ionic Tutorial part 3: Using NgRx Effects for Data Loading in an Ionic & Angular Application
- This project is licensed under the terms of the MIT license.
- Repo created by ABateman, email: gomezbateman@yahoo.com