合集-angular
摘要:环境安装 Node.js yarn(https://www.yarnpkg.cn/) npm install -g yarn @angular/cli 命令 https://angular.cn/cli npm install -g @angular/cli ng new 创建项目 --routin
阅读全文
摘要:# 安装 1 先添加一个 package.json npm init -y 2 使用命令 npm install rxjs 1.查看当前源 npm config get registry 更换npm源为国内淘宝镜像 npm config set registry https://registry.n
阅读全文
摘要:# 入门 引入 HttpClientModule 模块 ```typescript //app.module.ts import { HttpClientModule } from '@angular/common/http'; @NgModule({ imports: [ HttpClientMo
阅读全文
摘要:![](https://img2023.cnblogs.com/blog/196558/202309/196558-20230906230533876-2000815081.png) # 路由配置 最简单,一个配置项包含了 `path` 和 `component` 两个属性 ![](https://
阅读全文
摘要:![](https://img2023.cnblogs.com/blog/196558/202309/196558-20230903000250454-1044355921.png)
阅读全文
摘要:# # 第 2 章 第一个 Angular 程序 ## 添加第三方库(全局范围) ``` npm install bootstrap ``` ![](https://img2023.cnblogs.com/blog/196558/202308/196558-20230814224111580-857
阅读全文
摘要:angular 不要使用window、 document、 navigator等浏览器特有的类型以及直接操作DOM元素。 这样就引出了 Angular 主要特性之一:横跨所有平台。通过合适的方法,使用 Angular 构建的应用,可复用在多种不同平台的应用上 —— Web、移动 Web、移动应用、原
阅读全文
摘要:模块 @NgModule 的设计意图 静态的元数据 (declarations) 运行时的元数据 (providers) 组合与分组 (imports 和 exports) 《angular从零到一》说的简单些: NgModule是一个装饰器函数,它接收一个用来描述模块属性的元数据对象。其中最重要的
阅读全文
摘要:modal NgbActiveModal 链接 Class A reference to the currently opened (active) modal. 对当前打开的(active)modal 的引用,(就是现实的内容)。 Instances of this class can be in
阅读全文
摘要:(1)模板驱动表单 参考: 构建模板驱动表单 简单表单 ngForm 固定的,需要提交的值 ngModel <form #sub="ngForm" (submit)="onSubmit(sub)"> <input type="text" name="username" ngModel> <in
阅读全文
摘要:1 创建路由 创建路由配置 - RouterModule 添加导航链接 @NgModule({ imports: [BrowserModule, FormsModule, ModelModule, RouterModule], //导入 RouterModul 使用 <button class="b
阅读全文
摘要:服务和依赖注入 1 准备服务 @Injectable() export class DiscountService { ...2 准备依赖组件 import { Component, Input } from '@angular/core'; import { DiscountService } f
阅读全文