cosyer's Blog

Blog


  • 首页

  • 友链

  • 留言板

  • 归档

  • 关于

  • 搜索

angular 标签

7月
22
更新于
7月22
2020
Ng

Angular组件通讯

发表于 2020-03-15 | 热度 ℃
| 字数统计: 759 (字) | 阅读时长: 4 (分钟)

组件通讯,意在不同的指令和组件之间共享信息。

父->子 input

1
2
3
4
5
// parent.html
<child [content]="i"></child>

// child.ts
@Input() content:string;

子->父 output

1
2
3
4
5
6
7
// parent.html
<child (changeNumber)="changeNumber($event)"></child>

// child.ts
@Output() changeNumber: EventEmitter<number> = new EventEmitter();

this.changeNumber(1);

阅读全文 »
8月
31
更新于
8月31
2020
Ng

angular7详解

发表于 2018-12-19 | 热度 ℃
| 字数统计: 1,277 (字) | 阅读时长: 6 (分钟)

开始准备

  1. 安装nodejs

    1
    npm -v
  2. 安装@angular/cli

    1
    npm i -g @angular/cli
  3. CLI命令建立项目

    1
    ng new ng7demo

    选择是否加入路由模块以及哪种css预处理器

可ctrl+c取消自动安装node_modules,手动进入项目npm install node-sass安装不上可切换淘宝镜像库或者用cnpm安装

  1. npm config set registry https://registry.npm.taobao.org npm install

or

  1. npm install -g cnpm cnpm install

  2. 启动项目

    1
    ng serve --open // 自动打开浏览器 http://localhost:4200/

阅读全文 »
陈宇(cosyer)

陈宇(cosyer)

不去做的话永远也做不到。

159 日志
10 分类
51 标签
RSS
GitHub Twitter E-Mail FB Page
推荐阅读
  • Callmesoul
  • JsTips
  • Personal Site
  • Resume
© 2021 陈宇(cosyer)
终于等到你(UV):   |   欢迎再来(PV):
Blog总字数: 312.5k字
苏ICP备17005342号-1