Deborah's Developer MindScape

         Tips and Techniques for Web and .NET developers.

April 4, 2016

“Angular: Getting Started” Problem Solver

This blog post supports the sample code for the “Angular: Getting Started” course on Pluralsight, identifying common issues along with their solutions.

Revision History

August 14, 2019 – This course was updated for v8 as documented here.

November 8, 2018 – This course was updated for v7 as documented here.

July 11, 2018 – This course was updated for v6 as documented here.

August 10, 2017 – This course was updated to include the Angular CLI, the new HttpClient in v4.3, and more as documented here.

October 18, 2016 – This course was updated for the final release of Angular 2.

The content of this post is based on Angular version >= 8.x unless explicitly stated otherwise.

The sample code can be found here: The folders in this repo include:

  • APM–Start: The starter files. Use this as a starting point to code along with the course.
  • APM–Final: The completed files.

Please post to the Discussion tab for the course if you experience an issue not found in this post. Thanks!

Data Typing Issues

Problem: Odd typing issues such as Type ‘EventEmitter’ is not generic, or similar.

VS Code has been a bit too “helpful” with adding import statements and sometimes adds an incorrect one. For example, it may add the node EventEmitter instead of the Angular EventEmitter.

Solution: If you see a data typing error, first check your import statements at the top of the file and ensure they are correct.

Images Don’t Appear

Problem: Clicking on “Show Image” does not show the image, only a box with the image name.

If you look in the browser developer tools and see an error with the images, you may be missing the images. This will happen if you don’t use the provided starter files.

Solution: You have several options here:

  • Download the images from my github repo.
  • In the products.json file, replace the URL’s for the images with URLs to other images as desired.
  • Continue on as is. You can confirm that the button works by seeing the product name appear in the image column. The image itself is not necessary for successful instruction.

No Generated Test for Module

Problem: The command:

ng g m products/product --flat -m app

Does not generate a test as shown in the course.

Solution: That is new correct behavior.

An Angular module has no code to test, so generating a test for a module did not make sense. The Angular CLI was recently changed so it does not generate a test for the module. This will be changed in the course the next time the course is updated.

npm Issues

Problem: Error when using `npm install`.

There are several possible solutions depending on the source of your problem.

Solution 1: Ensure you have a current version of npm installed. The course was tested with node v10.x and npm 6.2.0. If your version is significantly older, it may not work. Use node –v and npm –v to check your versions. To install a newer version of both tools, use this link:

Solution 2: It may be a permissions problem. Try the steps found here:

Can’t See Stars

Problem: Can’t see any stars.

The stars are displayed using font-awesome, so if no stars appear, this often means that font-awesome was not installed or imported correctly or the styles for the stars are not set.

Solution: Re-watch the portion of the video detailing how to set up and import font-awesome:

At time code: 2:18. As per the video …

To install font-awesome use:

`npm install font-awesome`

Be sure you specify font-awesome (with a dash) and not fontawesome as the later is something else and won’t work.

To import font-awesome, in the style.css file:

`@import “~font-awesome/css/font-awesome.min.css”;`

Solution: Ensure the star.component.css file contains the following:

.crop {
  overflow: hidden;


Setting Up Behind a Corporate Web Proxy

Problem: Error performing `npm install`.

See these posts for more information:

NOTE: If the proxy requires authentication (which is usually true), please use this format

$ npm config set proxy http://login:pass@host:port
$ npm config set https-proxy http://login:pass@host:port

NOTE: If you do not have access to the proxy URL and port, you can install the missing typing manually following the steps posted by Joe Ballard in the comments for this post below. Note however that with Angular 2 final you need core-js and node NOT es6-shim. See the typings.json file for details.

I Don’t Want to use the Starter Files!

Problem: Some viewers prefer to build the code using the Angular CLI instead of using the starter files.

The instructions in the course were set up for viewers to use the Starter files. That way we could get going coding quickly, without having to set everything up first. I cover how to build an app from scratch using the Angular CLI in the “Building, Testing, and Deploying with the CLI” module later in the course.

Solution: If you want to build the code using the Angular CLI instead of using the starter files, you need to do the following:

1) Use the command: `ng new APM --prefix pm`

This sets the appropriate prefix for the child component we build later in the course.

2) Ensure the star.component.css file contains the following:

.crop {
    overflow: hidden;

3) Set up the folder for the data file used in the course:

In the angular.json file, add the api folder to the assets array:

"assets": [ 

Can I Follow the Course Without Installing Node?

Problem: Some viewers can’t install node due to limitations on installation of external apps or proxy issues. In this case, it still possible to code along with the course.

Solution: Use Stackblitz! Stackblitz is a playground that allows you to work with JavaScript, TypeScript, and Angular without downloading or installing anything.

To use Stackblitz with this course, use this link:

You should then be able to follow the this course using Stackblitz instead noting the following:

NOTE: If you chose to use Stackblitz, it currently does not support reading json files from a folder defined in the angular.json file. Rather, you need to copy the products folder from the api folder to the assets folder. Then modify the productUrl to look in the assets folder: private productUrl = ‘assets/products/products.json’;

NOTE: To install packages, such as bootstrap and font-awesome, you need to use the DEPENDENCIES branch in the Project hierarchy to the left of the code in Stackblitz:

  1. Open the DEPENDENCIES node. (You should see the list of existing dependencies such as @angular/common
  2. Below the list of dependencies is an input box with the text “enter package name”
  3. Enter bootstrap there and press enter.
  4. If it asks you to install missing dependencies, click “INSTALL MISSING DEPENDENCIES”
  5. Repeat step 3 with font-awesome

NOTE: Stackblitz does not seem to recognize the Font Awesome icons. So you will instead see portions of squares.

Port 4200 is Already in Use

Problem: When using npm start or ng serve you see the error: “Port 4200 is already in use”.

Solution: The Angular CLI serves the application on Port 4200. If you start up another application, it will start up on the same port and it will see that port as already in use.

There are several ways to solve this problem.

  • You can serve to a different port: ng serve -–port 4201 or similar. Or to serve and automatically open the browser: ng serve –o –-port 4201
  • You can kill the task holding on to the port:
    • On a Mac: sudo kill $(sudo lsof -t -i:4200) or sudo kill `sudo lsof -t -i:4200`
    • On a PC:
      • Open a command prompt as administrator
      • run netstat –ano | findstr :4200
      • kill the appropriate PID: taskkill /PID 10764 /F
  • You can reboot your system. This will release all of the ports.


Error Code 404 Resource Not Found

Problem: When attempting to load the products from the products.json file, a 404 error code is generated and the products.json file cannot be found.

Solution: You need to modify your angular.json file

In the course, I make the assumption that viewers will download the starter files for the code and “code along” from there following the same example. So I don’t mention any of the *other* steps that are required to code along “from scratch” or using other folders/files/names. (I instead cover how to build an Angular application “from scratch” and how to set up these files later in the course.)

If you are attempting to code along “from scratch”, you need to modify your angular.json file to look like this:

      "assets": [ 

This ensures that the Angular CLI finds the .json file in the api folder.

The Code Does Not Work in Internet Explorer (IE)

Problem: The sample application does not run, or it runs but nothing appears in the browser AND you are using Internet Explorer (IE).

Solution: You need to set up polyfills as part of your Angular application for the application to run correctly in IE.

As stated in Wikipedia: “a polyfill is code that implements a feature on web browsers that do not support the feature”

To set up polyfills, see the module entitled: “Building, Testing, and Deploying with the CLI” in the clip called: “ng new” at time code 2:51. Here is the link to that clip.

The AppRoutingModule Does Not Work

Problem: If you created an AppRoutingModule as defined in the “Revisiting AppModule” clip in the “Angular Modules” course module, the routes may stop working.

Solution: Order matters when defining routes. The AppRoutingModule must be *last* in the list of imports, after any feature modules. The details as to why are provided here:

Something is Wrong and the Code Doesn’t Work

Problem: JavaScript development in general can be difficult, so often something can go wrong.

Solution: Here are some tips for when your code doesn’t work:

  • JavaScript/Angular are CASE SENSITIVE. For example: “*ngIF” and “ngif” won’t work, must be “*ngIf”. This includes names. For example “@Angular/core” won’t work, must be “@angular/core”. If you name a route “products” it must be called “products” everywhere, and not “Products”. If you name your interface “IProduct” it must be called “IProduct” and not “Iproduct”. And so on.
  • Check the developer tools and view the console. Angular errors are shown there. Sometimes a little error causes a large message in the console. Start with the first or second line of the message. That often tells you exactly what is wrong.
  • Watch for typographical errors and syntax errors in the HTML. Unlike most Web apps, Angular is *not* forgiving when it comes to errors in the HTML. A missing or incorrect closing tag could prevent the application from working.
  • Try stopping and restarting the local server with ‘npm start’ again. Sometimes, especially when working with pipes and guards, the local server needs to be restarted for the changes to be fully recognized.
  • Try using a file compare utility and checking your code against the code for the course. You can find the starter files and final files in the github repo for this course. AND you can find the code as it should be at the end of each module using the “Exercise Files” tab on the Pluralsight page for the course.
  • Take care when finding solutions on the internet. Be sure the solution is appropriate for your version of Angular. Angular changed significantly from the Angular 2 RC versions to the final Angular 2 release. So any information posted prior to Angular 2’s release in September of 2016 can lead you down the wrong path.

“Can’t bind to ‘ngModel’ since it isn’t a known property of ‘input’.”

Problem: You will see the above message in the console.

Solution: This normally means that you are missing importing the FormsModule in your AppModule (or feature module).

How Do I Debug Angular?

Problem: Here was the question from a viewer: “Since the ts is compiled to js, there is a disconnect there for tracing code back to the source files…what tools do you recommend?”

Solution: TypeScript creates a map file that maps the js to your ts files. The best way to debug is to use the Chrome browser developer tools. With them you can set break points in your ts code.

See this link for more information:

Where Do I Go Next?

Problem: If you’ve finished the course, you may wonder where you should next on your Angular journey.

Solution: Here are some suggestions:


  1.   Nuren Geodakov — September 21, 2016 @ 11:02 am    

    Hello, Deborah
    I tried to set environment for your APM – FINAL UPDATED Angular 2 application and failed.
    The npm install command gives we the error:
    90 verbose stack Error: product-management@1.0.0 postinstall: `typings install`
    90 verbose stack Exit status 1
    90 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:242:16)
    90 verbose stack at emitTwo (events.js:106:13)
    90 verbose stack at EventEmitter.emit (events.js:191:7)
    90 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
    90 verbose stack at emitTwo (events.js:106:13)
    90 verbose stack at ChildProcess.emit (events.js:191:7)
    90 verbose stack at maybeClose (internal/child_process.js:877:16)
    90 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

    I tried to install typings globally as well: >npm install typings -g
    Got a bunch of errors like
    error for typings { Error: ENOENT: no such file or directory, open ‘C:\Users\NGEODA~1\AppData\Local\Temp\npm-13708-31de9bd0\unpack-d20c8124\package.json’

    I tried to use .typingsrc file:
    “rejectUnauthorized” : false,
    “strict-ssl” : false

    No luck.
    Any help will be appreciated.

    Thank you

    •   deborahk — October 19, 2016 @ 9:11 am    

      Could you try with the updated version of the code that was posted on October 18th?

      •   Richard Buck — October 19, 2016 @ 3:36 pm    

        Hi Nuren and Deborah,

        I’m getting exactly the same issue as Nuren, I’m using the latest version of the sample code.

        Nuren, have you has any luck resolving this issue?

        Thanks, Richard.

        •   deborahk — October 21, 2016 @ 6:05 pm    

          As per your message on the Discussion tab for the course, it seems you were able to run everything fine at home. It appeared to be a problem with your corporate proxy.

        •   rgrebski — October 23, 2016 @ 5:08 am    

          Try running
          sudo npm install

          worked for me

  2.   Vishal — October 17, 2016 @ 5:26 am    

    Hi When you will updating Angular 2 vedios on pluralsight. I am finding very hard to relate things.

    •   deborahk — October 19, 2016 @ 8:49 am    

      The update has just been released

  3.   Alex — October 18, 2016 @ 8:51 pm    

    It is out!!! Whoohooo!!!!

    •   deborahk — October 19, 2016 @ 9:11 am    


  4.   Carl FUNKE — October 27, 2016 @ 10:00 am    

    DEBORAH, I’ve been reading your books since Doing Objects in Visual Basic and generally love your stuff.. I work In a very secure setting. NPM just doesn’t work here.

    •   deborahk — November 3, 2016 @ 3:34 pm    

      Thank you for the kind words. The only thing I can think to suggest is to run ‘npm install’ from somewhere else to obtain all of the files you need. Then copy them to your machine at work.
      Alternatively, you could try using something like plunker ( to try out some Angular features.
      Let me know if you find a solution.

    •   deborahk — November 3, 2016 @ 3:53 pm    

      Something else to try is the detailed information here:

  5.   Danuta — November 22, 2016 @ 5:16 am    

    Hi Deborah,

    I’m learning angular 2 from your tutorial. I work with Visual studio 2015 and I cannot make Angular js 2 intellisense working. I see in your tutorial that when you put *ng in your html it works. Can you help me with that?
    Best Regards

    •   deborahk — December 6, 2016 @ 11:29 am    

      I don’t think that Visual Studio 2015 has HTML intellisense for Angular 2 yet. You should be seeing intellisense for the component code, however. Are you seeing that?

      •   Saad — December 7, 2016 @ 9:42 am    

        HI Deborah,
        Can you please tell me how intellisense is working on your VS Code? I am a new bee sorry. Thanks 😀

        •   deborahk — December 29, 2016 @ 10:22 am    

          Are you referring to the HTML? Or in the JavaScript code? VS Code does not yet support Angular directives in the HTML. You can install a VS Code extension to get HTML Intellisense. Hope this helps.

      •   Viv — December 13, 2016 @ 12:55 pm    

        I am also having this issue with Visual Studio Code. Not sure how to get intellisense to work with Angular 2 code.


        •   deborahk — December 29, 2016 @ 10:23 am    

          Are you referring to the HTML? Or in the JavaScript code? VS Code does not yet support Angular directives in the HTML. You can install a VS Code extension to get HTML Intellisense. Hope this helps.

  6.   Jon Sabogal — December 2, 2016 @ 9:01 am    

    Hi Deborah,

    Thank you for this great tutorial. I have two questions:

    1. My data services decorated as @Injectable only seem to pass data when I add them in the ‘providers’ array in the component’s metadata (the component consuming the service), even though I am also importing them via import statements above the component metadata. Any idea why this occurs?

    2. When I launch the application in debug mode, an exception “reflect-metadata shim is required when using class decorators” is thrown from makeDecorator() method in core.umd.js. This is strange as I have reflect-metadata already installed and reflect.js referenced in index.html just as you have.

    Any help with these would be appreciated, thanks.

    •   deborahk — December 6, 2016 @ 11:32 am    

      Thank you for your post! Your best bet is to post your issues in the discussion tab of the course. I check that much more frequently (and get emails when someone posts there). Here is the link:

      There should be no reason that you should need #1. Maybe it is related to #2?

      When you installed the code using ‘npm install’, did you see any errors? It almost sounds like something did not install properly.

  7.   James White — December 25, 2016 @ 10:08 am    

    Hi Deborah,

    I am seeing this error after doing the Data Binding and Pipes Module in the Handling Input with Two-way Binding section. The Forms Module is erroring out and I am receiving this message:

    [ts] Module ‘”c:/Users/James/PluralSight/GettingStartedAngular2/Angular2-GettingStarted-master/APM – Start/node_modules/@angular/core/index”‘ has no exported member ‘FormsModule’.

    Any help would be greatly appreciated.



    •   deborahk — December 29, 2016 @ 10:24 am    

      I see you posted in the discussion tab for the course. Thanks! I’ll work with you to resolve the error there.

  8.   SAURIN SHAH — January 4, 2017 @ 5:21 am    

    I found a wierd issue with running the APM – Final from visual studio 2015. Whenever I directly browse the link for the application with welcome or other route path, it does not work and keeps displaying 404 not found error from browser. The sample only works if I click options from menu options. How can I resolve the issue?

  9.   mayuresh — January 9, 2017 @ 3:14 pm    

    Hi Deborah – I downloaded the github Angular 2 getting started repo and just did npm install -g and npm start. I am getting this error.

    C:\Development\Apps\Angular2-GettingStarted-master\APM – Start>npm start

    > product-management@1.0.0 start C:\Development\Apps\Angular2-GettingStarted-master\APM – Start
    > tsc && concurrently “tsc -w” “lite-server”

    ‘tsc’ is not recognized as an internal or external command,
    operable program or batch file.

    npm ERR! Windows_NT 10.0.14393
    npm ERR! argv “C:\\Program Files\\nodejs\\node.exe” “C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js” “start”
    npm ERR! node v7.4.0
    npm ERR! npm v4.0.5
    npm ERR! code ELIFECYCLE
    npm ERR! product-management@1.0.0 start: `tsc && concurrently “tsc -w” “lite-server” `
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the product-management@1.0.0 start script ‘tsc && concurrently “tsc -w” “lite-server” ‘.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the product-management package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR! tsc && concurrently “tsc -w” “lite-server”
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR! npm bugs product-management
    npm ERR! Or if that isn’t available, you can get their info via:
    npm ERR! npm owner ls product-management
    npm ERR! There is likely additional logging output above.
    npm WARN Local package.json exists, but node_modules missing, did you mean to install?

    npm ERR! Please include the following file with any support request:
    npm ERR! C:\Development\Apps\Angular2-GettingStarted-master\APM – Start\npm-debug.log

    •   Timothy Byrd — January 24, 2017 @ 7:42 am    

      I am seeing the same issue it worked fine yesterday and today I came back in to continue the tutorial and see this issue.

      •   deborahk — January 27, 2017 @ 4:33 pm    

        Are you running ‘npm start’ from the directory containing the index.html and package.json files?

    •   deborahk — January 27, 2017 @ 4:32 pm    

      Did the npm install generate any errors?

  10.   Jahnzaib — January 25, 2017 @ 4:12 am    

    Hi Deborah I’m getting this error don’t know how to solve it.
    It occurs at the end of Chapter 10.

    TypeError: Cannot read property ‘length’ of undefined
    at ChangeDetector_ProductListComponent_0.detectChangesInRecordsInternal (viewFactory_ProductListComponent:296)
    at ChangeDetector_ProductListComponent_0.AbstractChangeDetector.detectChangesInRecords (
    at ChangeDetector_ProductListComponent_0.AbstractChangeDetector.runDetectChanges (
    at ChangeDetector_AppComponent_0.AbstractChangeDetector._detectChangesInViewChildren (
    at ChangeDetector_AppComponent_0.AbstractChangeDetector.runDetectChanges (
    at ChangeDetector_HostAppComponent_0.AbstractChangeDetector._detectChangesInViewChildren (
    at ChangeDetector_HostAppComponent_0.AbstractChangeDetector.runDetectChanges (
    at ChangeDetector_HostAppComponent_0.AbstractChangeDetector.detectChanges (
    at ChangeDetectorRef_.detectChanges (

    •   deborahk — January 27, 2017 @ 4:36 pm    

      Was this after you added the route guards? Or before?

Sorry, the comment form is closed at this time.

© 2022 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs