Installation — Angular Technical Interview Questions & Answers

Installation

Installation

  • Install: Node.js first (LTS), then npm i -g @angular/cli. Check ng version. If ng is not found, PATH is wrong — not Angular’s fault.
  • ng new marks-app. Pick routing yes, stylesheet CSS unless the team said SCSS. ng serve. Open localhost:4200. That is installation done. Don’t jump to Docker on day one.
  • Trap: old Node (12/14) with a new CLI. Another trap: creating the project outside the folder you think you’re in, then editing the wrong files.

Technical Interview Tip: Node → CLI → ng new → ng serve.

Code Examples for Installation

Installation — working example

import { Component } from "@angular/core";

@Component({
  selector: "app-root",
  template: `
    <h1>{{ title }}</h1>
    <button (click)="toggle()">Toggle</button>
    <p *ngIf="open">Panel open</p>
  `,
})
export class AppComponent {
  title = "Angular practice";
  open = true;
  toggle() {
    this.open = !this.open;
  }
}

Installation: toggle open. Say whether the panel is on screen after one click.

How to Explain Installation to an Interviewer

How do you start an Angular project?

Node LTS npm i -g @angular/cli ng new + ng serve

ng is not recognised. What first?

PATH / Node install Not a template bug