Angular2 / 4 - Unable to read resource subscription undefined

I am new to Angular and recently started learning it by reading the book "ng-book The Complete Book" on Angular 4. In the chapter How Angular Works I wrote a small inventory application followed by instructions for this book but having problems after launches shown below: error log in browser console

All my components look good and the errors just don't match my code. I even looked very similar compared to the loaded example code.

I know this is probably not that much, and I should move on and come back to it when I get more knowledge. But it really bothers me ...

Not sure what is the best way to show all my source code here, so I created a generic link to Google Drive and a .zip with everything in this project can be accessed from the link. ANY HELP WILL BE HIGHLY RECOGNIZED !!!

https://drive.google.com/file/d/0B76fFkACV6wRdmtJU0Jfc0J4U1U/view?usp=sharing

+3


source to share


1 answer


In ProductsListComponent you need to change:

@Output() onProductSelected: EventEmitter<Product>;

      

to:



@Output() onProductSelected = new EventEmitter<Product>();

      

Also remove the line in ngOnInit in the same component.

The event emulator must be initialized when the class is created. See this example: http://learnangular2.com/outputs/

+7


source







All Articles