![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Angular
JennyCqh
这个作者很懒,什么都没留下…
展开
-
去掉字符串中的HTML元素和CSS元素
1. 去掉HTML元素,类似: <p></p>s1=/<\/?.+?\/?>/g2. 去掉CSS元素,类似: .text_font{font-family:Arial,sans-serif;font-size:12px;}s2=/.+?\/?{\/?.+?\/?}/g;例子: message(str:string):any{consts1=/<\/?.+?\/?>/g;constmes...原创 2020-09-23 16:59:20 · 403 阅读 · 0 评论 -
angular 去掉href的unsafe
使用angular,herf莫名其妙多了unsafe导致不能够跳转解决方法:ts文件中添加以下代码:import {DomSanitizer} from '@angular/platform-browser';...constructor(private sanitizer:DomSanitizer){}...sanitize(url:string){ return this.sanitizer.bypassSecurityTrustUrl(url);}html&l原创 2020-09-02 17:39:33 · 525 阅读 · 0 评论 -
angular使用*ngFor获取index
angular使用*ngFor获取index例子:<ul> <li *ngFor="let item of items; let i = index"> {{item}} <i (click)="delete(i)">x</i> </li></ul>原创 2020-08-27 14:45:26 · 3171 阅读 · 0 评论 -
Could not find module "@angular-devkit/build-angular"
Angular 启动项目时报以下错误:Could not find module "@angular-devkit/build-angular" from "D:\\xxx".解决方法,运行以下命令:npm i --save-dev @angular-devkit/build-angular ...原创 2019-01-30 10:14:30 · 1467 阅读 · 1 评论 -
Port 4200 is already in use. Use ‘--port‘ to specify a different port.
运行多个Angular的时候,或者Angular之前运行的时候没有正常关闭,端口4200会被占用。错误如下所示:Port 4200 is already in use. Use '--port' to specify a different port.解决方法:1、 输入cmd,打开cmd命令框。输入netstat -nao|findstr 4200,最后一列是PID(程序id),可...原创 2019-01-30 17:16:06 · 900 阅读 · 0 评论