Errata

Mobile App Development with Ionic 2

Errata for Mobile App Development with Ionic 2

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
1st paragraph

On Chapter:
Chapter 7. Building Our Ionic2Do App

On 1st Paragraph:

Another reason is that a to-do app has more complexity that simply printing out “Hello World” on a screen.



that simply -> than simply

Note from the Author or Editor:
Another reason is that a to-do app has more complexity than simply printing out “Hello World” on a screen.

Anonymous  May 01, 2017 
Chapter 7, section "Using Firebase Data"

Looks like AngularFire updated itself,

instead of "import { AngularFire, FirebaseListObservable } from 'angularfire2';;" it should be
import {AngularFireDatabase, FirebaseListObservable} from 'angularfire2/database';

instead "this.tasks = af.database.list('/tasks');" it should be "this.tasks = af.list('/tasks');"

Note from the Author or Editor:
Managing the changes to AngularFire can be found here:
https://chrisgriffith.wordpress.com/2017/05/17/angularfire-2-updates/

Anonymous  Jul 13, 2017 
PDF
Page 41
Last paragraph

Both the ViewChild module and UserProfile component are injected from the
Angular Core.

import {Component, ViewChild} from '@angular/core';
import {UserProfile} from '../user-profile';

-> UserProfile is not injected from Angular Core.

And:

export class MasterPage {
// we pass the Component we want to get
// assign to a public property on our class
// give it the type for our component
@ViewChild(UserProfile) userProfile: UserProfile
constructor() { }
update(){
this.userProfile.sendData();
}
}

Our constructor contains our ViewChild decorator that set our userProfile variable to our injected component.

-> The MasterPage class contains the ViewChild decorator and its constructor ...

Note from the Author or Editor:
Both the ViewChild module and Component component are injected from the Angular Core

Anonymous  May 10, 2017 
PDF
Page 69
2nd last paragraph on page

import { NgModule, ErrorHandler } from '@angular/core';
...

The first import statement loads the Component module from Angular core.

-> The narration is correct but the code extract is not (the narration and code extra don't match).

Should be:

import { Component, ViewChild } from '@angular/core';
...

Note from the Author or Editor:
The code block should actually be:
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { HomePage } from '../pages/home/home';

Anonymous  May 12, 2017 
PDF
Page 155
Last chunk of code at the end of the page

The code at the bottom of the page lists an } else { statement that is run if the loc variable is defined. However, no if () { statement is listed at the beginning of the code, or anywhere else concerning this chunk of code. The code should include if (loc === undefined) { before the first line (geolocation.getCurrentPosition().then(pos => {) in order to run properly.

Note from the Author or Editor:
Yes, this code block is missing the test for if the loc variable is undefined. Here is the full code block based on the printed version:
if (loc === undefined) {
geolocation.getCurrentPosition().then(pos => {
console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude);
this.currentLoc.lat = pos.coords.latitude;
this.currentLoc.lon = pos.coords.longitude;
this.currentLoc.timestamp = pos.timestamp;
return this.currentLoc;
}).then(currentLoc => {
weatherService.getWeather(currentLoc).then(theResult => {
this.theWeather = theResult;
this.currentData = this.theWeather.currently;
this.daily = this.theWeather.daily;
loader.dismiss();
});
});
} else {
this.currentLoc = loc;
this.pageTitle = this.navParams.get('title');
weatherService.getWeather(this.currentLoc).then(theResult => {
this.theWeather = theResult;
this.currentData = this.theWeather.currently;
this.daily = this.theWeather.daily;
loader.dismiss();
});
}
Note: If you are using Ionic 3, the this.daily = this.theWeather.daily; references will need to be replaced with:
this.day1 = this.theWeather.daily.data[0];
this.day2 = this.theWeather.daily.data[1];
this.day3 = this.theWeather.daily.data[2];

Anonymous  Apr 20, 2017