随笔分类 -  Angular

摘要:当ng new 新项目时,会问是否加入路由,选择yes即可 具体表现:在app.moudle.ts中,引入路由:import { AppRoutingModule } from './app-routing.module';并配置:imports中加入 AppRoutingModule 在app.c 阅读全文
posted @ 2020-01-18 14:29 毛毛球的书签 阅读(436) 评论(0) 推荐(0)
摘要:1:创建服务:ng g service services/request 2:使用rxjs就需要在service 中引用: import { Observable } from 'rxjs'; 3:在组件中引用服务: import { RequestService } from '../../ser 阅读全文
posted @ 2020-01-06 23:29 毛毛球的书签 阅读(728) 评论(0) 推荐(0)
摘要:1:新建项目后,新增两个组件: ng g component relations/footer (子组件) ng g component relations/home (父组件) 2:引用 在app.component.html中引用home标签:<app-home></app-home> 在hom 阅读全文
posted @ 2020-01-05 19:02 毛毛球的书签 阅读(445) 评论(0) 推荐(0)
摘要:1:在新项目中,新增 dom-operaiton 和 sub-dom 两个组件,并且 sub-dom放入 dom-operation中 ng g component components/dom-operaiton ng g component components/sub-dom 在 dom-op 阅读全文
posted @ 2020-01-05 15:54 毛毛球的书签 阅读(562) 评论(0) 推荐(0)
摘要:基于上一篇内容,先打开vscode终端 1:创建服务: ng g service services/storage 2:数据双向绑定记得引用form moduler, 使用服务记得要引用服务,如下: 在app.module.ts中,引入并配置服务: import { StorageService } 阅读全文
posted @ 2020-01-04 22:37 毛毛球的书签 阅读(379) 评论(0) 推荐(0)
摘要:1:使用vscode打开事先准备好的空项目 2:创建表单组件:ng g component components/form 3:在app.component.html中引用该标签:<app-form></app-form> 4:引用表单组件,才能实现双向绑定,在app.module.ts里面: im 阅读全文
posted @ 2020-01-04 21:52 毛毛球的书签 阅读(624) 评论(0) 推荐(0)
摘要:使用vscode打开前期准备的项目 1:创建header组件: ng g component components/header 2:在app.component.html中,引用该标签: <app-header></app-header> 3:数据绑定 : 属性,数据,带有标签数据,数据循环,图片 阅读全文
posted @ 2020-01-04 21:21 毛毛球的书签 阅读(119) 评论(0) 推荐(0)
摘要:1:下载nodejs : https://nodejs.org/en/ 推荐稳定版本 2: 安装 angular CLI 因为angular-cli是用typescript写的,所以要先装这两个npm install -g typescript typings,安装方式如下2中: 安装方法一:npm 阅读全文
posted @ 2019-12-29 17:25 毛毛球的书签 阅读(222) 评论(0) 推荐(0)