angular hero学习

install node
https://nodejs.org

C:\xxx\Downloads\node-v20.10.0-x64
C:\Program Files\nodejs\

C:\angular>node -v
v20.10.0
C:\angular>npm -v
10.2.3

install angualr
npm install -g @angular/cli
error

# 设置淘宝源
npm config set registry https://registry.npm.taobao.org
npm config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass
# 恢复默认源
npm config delete registry
npm config delete sass_binary_site

C:\angular>npm install -g @angular/cli

added 227 packages in 16s
npm notice
npm notice New patch version of npm available! 10.2.3 -> 10.2.5
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.2.5
npm notice Run npm install -g npm@10.2.5 to update!
npm notice

ng new angular-tour-of-heroes --no-standalone --routing --ssr=false
cd angular-tour-of-heroes
ng serve --open

修改显示:
title = 'Tour of Heroes';
双花括号语法是 Angular 的插值绑定语法
<h1>{ {title}}</h1>
打开 src/styles.css 并把下列代码添加到此文件中。

创建新组件
ng generate component heroes
C:\angular\angular-tour-of-heroes>ng generate component heroes
CREATE src/app/heroes/heroes.component.html (21 bytes)
CREATE src/app/heroes/heroes.component.spec.ts (601 bytes)
CREATE src/app/heroes/heroes.component.ts (199 bytes)
CREATE src/app/heroes/heroes.component.css (0 bytes)
UPDATE src/app/app.module.ts (475 bytes)

hero = 'Windstorm';

接口类:
export interface Hero {
  id: number;
  name: string;
}

管道
<h2>{ {hero.name | uppercase}} Details</h2>

双向绑定
<div>
  <label for="name">Hero name: </label>
  <input id="name" [(ngModel)]="hero.name" placeholder="name">
</div>

相关推荐

  1. 学习 学习

    2023-12-15 18:36:01       66 阅读
  2. 学期学习计划

    2023-12-15 18:36:01       45 阅读
  3. 学习笔记:机器学习

    2023-12-15 18:36:01       79 阅读
  4. C++学习-List学习

    2023-12-15 18:36:01       51 阅读
  5. opencv学习 机器学习

    2023-12-15 18:36:01       58 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-15 18:36:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-15 18:36:01       100 阅读
  3. 在Django里面运行非项目文件

    2023-12-15 18:36:01       82 阅读
  4. Python语言-面向对象

    2023-12-15 18:36:01       91 阅读

热门阅读

  1. (第21天)Oracle 数据泵常用参数和命令

    2023-12-15 18:36:01       49 阅读
  2. Vue 宝典之动画(transition)

    2023-12-15 18:36:01       66 阅读
  3. postman中Test断言介绍

    2023-12-15 18:36:01       50 阅读
  4. 算法训练营Day15

    2023-12-15 18:36:01       60 阅读
  5. 1.两数之和

    2023-12-15 18:36:01       58 阅读
  6. Makefile

    Makefile

    2023-12-15 18:36:01      53 阅读
  7. 2023数学建模黄河水沙监测数据分析思路

    2023-12-15 18:36:01       50 阅读
  8. Linux .a .so 整理记录

    2023-12-15 18:36:01       59 阅读
  9. 全栈开发组合

    2023-12-15 18:36:01       66 阅读