In this chapter, you got to know Google Firebase. You have read data from a data-base with the aid of HttpClient.
You sorted and filtered data using the Lodash library to make it appealing in the app.
You got to know route parameters as a supplement to the Angular routing con-cept.
Finally, with Local Storage and Ionic Storage, you’ve used a variety of ways to store user-specific data.

Any remarks or questions?

11 comments

  1. Charles Almeida

    Reply

    Hi! good evening.
    I have an error:
    core.js: 6162 ERROR TypeError: Cannot read property ‘favTours’ of undefined

    Could you help me, please.

    Grateful.

    • Andionic

      Reply

      You try to assign a property to a non existing object.
      Declare favTours and set a value for it, e.g.
      favTours = {}

  2. Tarcísio

    Reply

    Hi Andreas, thank your for your great book.
    In section 5.9, I executed: npm install –save @ionic/storage
    and I imported in app.module.ts: import { IonicStorageModule } from ‘@ionic/storage’;
    but, I obtained an error:
    ERROR in The target entry-point “@ionic/storage” has missing dependencies:
    [ng] – @angular/core
    [ng] – @angular/common
    [ng]
    [ng] ERROR in ../../../../node_modules/@ionic/storage/index.d.ts:1:37 – error TS2307: Cannot find module ‘@angular/core’ or its corresponding type declarations.
    [ng]
    [ng] 1 import { ModuleWithProviders } from ‘@angular/core’;
    [ng] ~~~~~~~~~~~~~~~
    [ng] ../../../../node_modules/@ionic/storage/storage.d.ts:2:32 – error TS2307: Cannot find module ‘@angular/core’ or its corresponding type declarations.
    [ng]
    [ng] 2 import { InjectionToken } from ‘@angular/core’;
    [ng] ~~~~~~~~~~~~~~~
    [ng]
    .
    How I can solve this?

    • Andionic

      Reply

      Did you add it to the imports section of @NgModule like described on page 147?
      And is your system up to date?

  3. Mark

    Reply

    Andreas,

    This book is wonderful! This is how these books should be written. Thank you!

    I am stuck, however in chapter 5…

    In section 5.5 we add Lodash:
    import _ from ‘lodash’;

    I am getting this problem in the Visual Studio Code error console:
    Module ‘”/home/Projects/ionic/bob-tours/node_modules/@types/lodash/ts3.1/index”‘ can only be default-imported using the ‘allowSyntheticDefaultImports’ flag
    index.d.ts[14,1]: This module is declared with using ‘export =’, and can only be used with a default import when using the ‘allowSyntheticDefaultImports’ flag.

    $ ionic -v
    6.4.3

    Any ideas?

    Thanks!!!

    • Andionic

      Reply

      You’re using TypeScript 3.1. This way you can use

      import * as _ from 'lodash';

      and it should work.

      Thanks for your kind words about my book, Mark! Maybe you would like to write a small review on amazon?

      • Mark

        Reply

        Andreas,

        That did the trick!!! Thanks!

        Thanks for the fast reply. I will mention it in my review 😉

  4. José Augusto de Godoy

    Reply

    Good Morning.
    conexao PHP: $sql = $conexao->prepare(‘SELECT * FROM municipios limit 1’);
    $sql->execute();
    $dados1 = “[“;
    while($lista = $sql->fetch()){$dados1 .=”‘”.$lista[“id”].”‘”‘.’,’;$dados1 .=”‘”.$lista[“uf”].”‘”;}$dados1 .=”]”;
    $dados1json = json_encode($dados1);
    echo ($dados1json);

    Console: “[‘1′,’MS’]”

    bob-tours-service.ts return this.http.get(“http://localhost/conexao.php”).toPromise();
    regions.page.ts: this.btService.getRegions().then(data => this.regions = data);
    So far here all ok
    There is only an error in regions.page.html
    regions.page.html:

    ERROR Error: Cannot find a differ supporting object ‘[“1″,”MS”]’ of type ‘string’. NgFor only supports binding to Iterables such as Arrays.

    Would you help me?

    Thanks.

Leave a comment

Your email address will not be published. Required fields are marked *