随笔分类 - Angular
摘要:1、angular 使用 bootstrap 安装bootstrap npm install bootstrap --save 安装bootstrap-icons npm i bootstrap-icons 并在angular.json添加配置 "styles": [ "src/styles.scs
阅读全文
摘要:1、定义路由快照 新建文件SimpleReuseStrategy.ts import { RouteReuseStrategy, DefaultUrlSerializer, ActivatedRouteSnapshot, DetachedRouteHandle, Route } from '@ang
阅读全文
摘要:1、写注册表 新建 .reg文件 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\creoparametric] "URL Protocol"="" @="URL:creoparametric" [HKEY_CLASSES_ROOT\c
阅读全文
摘要:1.安装包 npm install @ngx-translate/core --save npm install @ngx-translate/http-loader --save 2.根模块app.module.ts 引入 import { HttpClientModule, HttpClient
阅读全文
摘要:1.安装包 npm install @ngx-translate/core --save npm install @ngx-translate/http-loader --save 2.根模块app.module.ts 引入 import { HttpClientModule, HttpClient
阅读全文
摘要:1.IIS服务器需要安装插件 安装 Url https://www.iis.net/downloads/microsoft/url-rewrite 2.修改配置 在src目录下,添加 web.config <configuration> <system.webServer> <rewrite> <r
阅读全文
摘要:1.安装库和依赖 npm i echarts --save npm i ngx-echarts --save npm i resize-observer-polyfill --save-dev 2.相关配置 在module添加 import { NgxEchartsModule } from 'ng
阅读全文
摘要:第一部分:封装http请求 1.定义 ResultDataModel export interface ResultDataModel<T> { success: boolean; errCode: number; message: string; data: T; pageModel: PageM
阅读全文
摘要:1.新建项目(带路由) ng new demo --routing 2.新建组件 统一放到components目录下(文件夹会自动创建) ng g component components/home 在components下新建文件夹 home,并创建四个组件文件 3.新建服务 ng g servi
阅读全文
摘要:ng add @angular/material 自定义预构建主题 ? Choose a prebuilt theme name, or "custom" for a custom theme: Custom ? Set up global Angular Material typography s
阅读全文
摘要:1.先做一个简单的例子 => 定义一个div 从open渐变成closed ts:定义一个触发器 openClose,有两个状态 open 和 closed,均有对应的样式,再定义装换函数 transition html:@后面指定触发器 并赋值状态
阅读全文
摘要:1.先不做上拉触发,用button模拟一下,触发函数 html 2.若是有两个列表(像顶部tab有 待处理、全部) html
阅读全文
摘要:1.回调函数 这样做可以通过3给2传入不同的函数名而实现不同的操作。 2.Promise 3.Observable 3.1先写一个简单的例子,5s内每隔一秒打印一次‘hello’ 3.2 of创建Observable 并订阅一个Observer of创建一个可观察对象,上面的代码等价于 3.3 页面
阅读全文
摘要:1.回调函数 这是我们定义好的两个函数,当调用这两个函数的时候,因为setTimeout是异步的,所以并不能正常返回值,补全返回类型可以使我们更加直观的看出效果。 console.log(this.getName()); //输出:张三 console.log(this.getAsyncName()
阅读全文
摘要:1.ts 2.html 3.scss 图示:
阅读全文
摘要:1.绑定html 在ts里面自定义一个html变量 在html打印出来 2.ng 3.管道 主要用于格式化数据。 更多管道:http://bbs.itying.com/topic/5bf519657e9f5911d41f2a34 4.事件 click 点击(有延迟) tap 点击(无延迟) keyd
阅读全文
摘要:Routing 1.新建一个带路由的Angular项目 ng new demo-routing --routing 2.新建组件 ng g component components/home ng g component components/news ng g component componen
阅读全文
摘要:父子组件传值 我们这里定义 父组件为weather,子组件为header 先是介绍一下子组件调用父组件 1)Input调用值: 在父组件中定义属性: 并且在html中把这个值给子组件传递过去 子组件要使用Input接收 html 2)Input调用函数: 和传值的方法一样 在父组件中定义函数: 并且
阅读全文