Angular Local Development Guide

Create projects using Angular CLI and start the development server at localhost:4200, supporting components, routing, and dependency injection.


Angular is an enterprise-level TypeScript frontend framework maintained by Google, providing a complete CLI toolchain, component-based architecture, routing, forms, and an HTTP client, making it suitable for large SPAs and backend management systems.

Quick Start

npm install -g @angular/cli
ng new my-app
cd my-app
ng serve

Or use a non-global installation:

npx @angular/cli@latest new my-app
cd my-app
npx ng serve

Default localhost Access

PurposeAddress
Development Serverhttp://localhost:4200

To change the port: ng serve --port 4300 or configure serve.options.port in angular.json.

Common Commands

CommandDescription
ng serveStart the development server (hot reload)
ng buildBuild to dist/
ng testRun unit tests
ng generate component fooGenerate component scaffolding

Integrating with Backend APIs

During development, you can configure a proxy in proxy.conf.json to forward /api to your local backend:

{
  "/api": {
    "target": "http://localhost:8080",
    "secure": false
  }
}

Start with: ng serve --proxy-config proxy.conf.json.

Summary

The default local development for Angular is http://localhost:4200. With a standardized structure and a mature toolchain, it is suitable for large TypeScript frontend projects and team collaboration.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run