angular-services

Built With

Getting Started

Prerequisites

Project Setup (VS Code)

  • Angular

    • Install Angular CLI globally (one time setup)
    npm install -g @angular/cli
    ng version
    • Open project in vsCode (command run in the project directory)
    code .
    • Create Angular App
    ng new project-name
    ng serve
  • Create new Angular Component

    ng generate component component-name
    • Create new Angular Service
    ng generate service service-name

Topics practiced to get things done

Angular

-Service
-Dependency Injection
-Observables

Error messages for future reference

✖ Error: Invalid Character (typing ng --version in the terminal)
Solution: Use bash (workaround)
✖ Error: Property 'name' has no initializer and is not definitely assigned in the constructor.
Solution: Add "strictPropertyInitialization": false in the compiler options of the tsconfig.json or a default value to the property.
✖ Error: Can't bind to 'ngModel' since it isn't a known property of 'input'.
Solution: Add FormsModule and ReactiveFormsModule to the imports array in app.module.ts.
✖ Error: Can't bind to 'ngForOf' since it isn't a known property of 'tr'.
Solution: Add BrowserModule to app.module.ts or check for typos, ex: *ngfor, instead of *ngFor.