This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const selectCarState = (state: State) => state.cars; | |
| export const selectPlaceState = (state: State) => state.places; | |
| export const { selectAll: selectAllCars } = adapterCar.getSelectors(); | |
| export const { selectAll: selectAllPlaces } = adapterPlace.getSelectors(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function reducer(state: State = initialState, action: ExampleActions): State { | |
| switch (action.type) { | |
| case ExampleActionTypes.GetCarList: | |
| return { ...state, cars: adapterCar.addMany(action.payload, state.cars) }; | |
| case ExampleActionTypes.GetPlaceList: | |
| const { payload } = action; | |
| return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const initialState = { | |
| msg: 'Multiple entities in the same state', | |
| cars: carInitialState, | |
| places: placeInitialState | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const adapterCar = createEntityAdapter<Car>(); | |
| const adapterPlace = createEntityAdapter<Place>(); | |
| const carInitialState: CarState = adapterCar.getInitialState({ total: 0 }); | |
| const placeInitialState: PlaceState = adapterPlace.getInitialState({ total: 0 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface State { | |
| msg: string; | |
| cars: CarState; | |
| places: PlaceState; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface CarState extends EntityState<Car> { | |
| total: number; | |
| } | |
| interface PlaceState extends EntityState<Place> { | |
| total: number; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| Directive, | |
| ElementRef, | |
| EventEmitter, | |
| Input, | |
| Output, | |
| OnInit, OnDestroy, Renderer2 | |
| } from '@angular/core'; | |
| import { ImgCacheService } from './img-cache.service'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| import { File } from '@ionic-native/file'; | |
| import { Platform } from 'ionic-angular'; | |
| import ImgCache from '@chrisben/imgcache.js'; | |
| import { ReplaySubject } from 'rxjs/ReplaySubject'; | |
| import { map, take, flatMap, switchMapTo, tap } from 'rxjs/operators'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import { bindCallback } from 'rxjs/observable/bindCallback'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm install imgcache.js --save | |
| ionic cordova plugin add cordova-plugin-file --save | |
| ionic cordova plugin add cordova-plugin-device --save | |
| ionic cordova plugin add cordova-plugin-file-transfer --save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <access origin="*" /> | |
| <access origin="cdvfile://*" /> | |
| <allow-intent href="cdvfile://*" /> | |
| <feature name="Device"> | |
| <param name="ios-package" value="CDVDevice" /> | |
| <param name="android-package" value="org.apache.cordova.device.Device" /> | |
| </feature> | |
| <feature name="File"> | |
| <param name="ios-package" value="CDVFile" /> | |
| <param name="android-package" value="org.apache.cordova.file.FileUtils" /> |
NewerOlder