xinxin?

2020年10月21日

Angular:惰性加载的模块

摘要: ①通过ng new angular-module创建一个全新的angular应用,默认不选路由 ②通过一下命令分别创建2个模块和1个组件 ng g m hx1 ng g c hx1 ng g m hx2 ng g c hx2 ng g c hx3 创建完成目录如下 ③将app.module和app. 阅读全文

posted @ 2020-10-21 22:59 xinxin? 阅读(180) 评论(0) 推荐(0) 编辑

2020年8月5日

JavaScript:记录一些字符串和数组常用的方法

摘要: 字符串: 字符串的方法:注意:都不会改变原来的字符串,返回值为新的字符串。如果(1,2),一般是包含小标1,不包含下标2 str.charAt(i): 取str的第i+1个字符,类似数组的arr[i]. str.substring(start,end):抽取字符串。和slice基本一样,不识别负数 阅读全文

posted @ 2020-08-05 23:39 xinxin? 阅读(144) 评论(0) 推荐(0) 编辑

JavaScript:正则表达式匹配规则

摘要: 正则表达式的语法规则:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title> 阅读全文

posted @ 2020-08-05 23:19 xinxin? 阅读(742) 评论(0) 推荐(0) 编辑

2020年8月4日

JavaScript:常用的一些数组遍历的方法

摘要: 常用的一些遍历数组的方法: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <script type="text/javascript"> var students=[ { nam 阅读全文

posted @ 2020-08-04 23:30 xinxin? 阅读(162) 评论(0) 推荐(0) 编辑

2020年8月1日

Angular:组件之间的通信@Input、@Output和ViewChild

摘要: ①父组件给子组件传值 1、父组件: ts: export class HomeComponent implements OnInit { public hxTitle = '我是首页的头部'; constructor() { } ngOnInit(): void { } run(): void { 阅读全文

posted @ 2020-08-01 17:20 xinxin? 阅读(254) 评论(0) 推荐(0) 编辑

Angular:管道和自定义管道

摘要: ①管道的使用,更多管道在angular官网上有 <p>全部转为大写:{{'hahahah' | uppercase}}</p> <p>保留两位小数:{{1.45555 | number:'1.1-2'}}</p> ②自定义管道 1、使用ng g pipe创建一个管道类文件 2、对pipes/pow. 阅读全文

posted @ 2020-08-01 16:37 xinxin? 阅读(222) 评论(0) 推荐(0) 编辑

Angular:自定义属性指令

摘要: ①在命令行窗口下用 CLI 命令ng g directive创建指令类文件 ②将directives/light.directive.ts文件改造一番 import { Directive, ElementRef, HostListener, Input } from '@angular/core' 阅读全文

posted @ 2020-08-01 16:05 xinxin? 阅读(262) 评论(0) 推荐(0) 编辑

2020年7月28日

Angular:使用前端proxy代理解决跨域问题

摘要: ①在项目文件的根目录下新建文件proxy.config.json { "/": { "target": "http://127.0.0.1:3000", "secure": false } } //或者 { "/api": { //适用场景:需要每个请求地址前加个’/api‘ "target": " 阅读全文

posted @ 2020-07-28 23:20 xinxin? 阅读(833) 评论(0) 推荐(0) 编辑

2020年7月26日

Angular:路由的配置、传参以及跳转

摘要: ①路由的配置 1、首先用脚手架新建一个项目,在路由配置时选择yes 2、用ng g component创建组件 3、在src/app/app-routing.module.ts中配置路由 import { NgModule } from '@angular/core'; import { Route 阅读全文

posted @ 2020-07-26 15:15 xinxin? 阅读(514) 评论(0) 推荐(0) 编辑

2020年7月25日

Angular:使用service进行http请求的简单封装

摘要: ①使用ng g service services/storage创建一个服务组件 ②在app.module.ts 中引入HttpClientModule模块 ③在app.module.ts 中引入创建的服务 ④在services/http.service.ts中封装一个简单的http请求 impor 阅读全文

posted @ 2020-07-25 22:23 xinxin? 阅读(1425) 评论(0) 推荐(0) 编辑

导航