deeleman / learning-angular2

Code samples repository for the examples provided in "Learning Angular 2", published by Packt Publishing - THE BOOK COVERS UP TO RC.1 and hence is severely OUTDATED. PLEASE REFER TO THE LATEST EDITIONS INSTEAD.
https://www.packtpub.com/web-development/learning-angular-2
108 stars 59 forks source link

Chapter 7 Section 2 - app.components deviation from previous chapters #34

Closed RichLinnell closed 8 years ago

RichLinnell commented 8 years ago

A couple of inconsistencies arose in my code whilst trying to get the routing working. Firstly, and most importantly, my import statements in app.component.ts were set up using the following format after chapter 6

import { TIMER_DIRECTIVES } from './timer/timer'; import { TASKS_DIRECTIVES } from './tasks/tasks';

this led to issues in the @routeConfig statement where it had no reference to TaskComponent, TaskEditorComponent or TimerComponent.

I had to change the imports to explicitly mention the components that we are using, which seems to devalue the use of the barrel in the first place.

import {TimerWidgetComponent} from './timer/timer'; import {TaskComponent,TaskEditorComponent} from './tasks/tasks';

Secondly, the naming of the components has changed between the chapters. I had TimerWidgetComponent and TaskComponent (singular) which added more confusion.

deeleman commented 8 years ago

I've double checked the book contents and the component type is properly exported from app/tasks/tasks.ts, as instructed on page 190.