随笔分类 -  angular

摘要:1. 单独新建一个service文件ng g service 服务名 2. 编辑service文件 import { Injectable } from '@angular/core'; import { Subject, Observable } from 'rxjs'; @Injectable( 阅读全文
posted @ 2023-03-29 10:32 抽风的皮鞭 阅读(210) 评论(0) 推荐(0)
摘要:1. 根目录下新建proxy.conf.json文件 { "/api/*": { "target": "http://localhost:4200", "secure": false, "changeOrigin": true, "pathRewrite": { "^/api": "" // 将请求 阅读全文
posted @ 2022-12-12 15:30 抽风的皮鞭 阅读(487) 评论(0) 推荐(0)
摘要:我们node项目中cache和cookie中保存中文时不能直接保存,要用base64加密来保存。当我们项目中在浏览器端通过http请求到这些加密字符串进行解密展示时会出现部分乱码,原因是接收到数据后浏览器会先对加密字符串做一层加密,会改变部分字符,造成正常解析失败,解决方法是: import { B 阅读全文
posted @ 2022-12-09 16:01 抽风的皮鞭 阅读(801) 评论(0) 推荐(0)
摘要:因为angular项目需要实现markdown的编辑预览功能,所以在网上查找了下资料,找到了editor.md插件来实现这个功能,经过不断踩坑,总算实现了功能需求。 使用方法如下: 首先我们进到官网:https://pandao.github.io/editor.md/ 官网提供了三种下载方式: 但 阅读全文
posted @ 2022-12-05 09:37 抽风的皮鞭 阅读(737) 评论(0) 推荐(0)
摘要:app.components.ts import { PlatformLocation } from '@angular/common'; constructor(private location: PlatformLocation){ // 监听直接修改地址栏url实现路由跳转 this.loca 阅读全文
posted @ 2022-05-06 14:55 抽风的皮鞭 阅读(116) 评论(0) 推荐(0)