前沿web开发框架
Angular
Angular 是一个开发平台。它能帮你更轻松的构建 Web 应用。Angular 集声明式模板、依赖注入、端到端工具和一些最佳实践于一身,为你解决开发方面的各种挑战。Angular 为开发者提升构建 Web、手机或桌面应用的能力。
“rxjs” observable.throw is not a function
2020年05月25日
最近在处理Angular Observable错误的的时候,出现了如下错误:“rxjs” observable.throw is not a function出现问题的原因:由于版本变更,原来的写法已经不再使用。具体代码如下:private static handleErrors(error: any): Observable { const errors: string[] = [];...
Could not subscribe to notifications Error: Service workers are disabled or not supported by this browser
2020年05月25日
最近在Angular中需要使用notification推送服务,按照这篇文章操作:Angular Push Notifications: a Complete Step-by-Step Guide,在点击订阅的时候出现了如下错误:Could not subscribe to notifications Error: Service workers are disabled or not suppo...
Angular 父组件向子组件传值
2020年05月23日
最近有一个需求:在Angular里面,父组件向子组件传值。子组件代码如下:component-interaction/src/app/hero-parent.component.tsimport { Component } from '@angular/core'; import { HEROES } from './hero'; @Component({ selector: '...
mat-expansion-panel *ngfor [ngClass]的处理
2020年05月19日
最近在使用Angular Material 的<mat-expansion-panel>展示数据,使用*ngFor批量显示数据,但是在点击展开面板的时候,低下所有的<mat-expansion-panel>都使用了相同的样式,这样肯定不是我要的结果。下面是示例代码:<mat-accordion *ngFor="let item of sub"> <mat-expansion-panel (ope...
inmemorydbservice multiple collection
2020年05月19日
在Angular中使用angular-in-memory-web-api,做后台数据模拟,单个数据集合具体用法可以参考这篇文章:使用Angular in-memory-web-api 无任何数据,在此处不多说。但是如果angular-in-memory-web-api有多个数据集合,应该如何处理呢?可以这样处理,具体代码如下:createDb() { let heroes = [ .. ];...
TSLint: object access via string literals is disallowed(no-string-literal)
2020年05月18日
最近在使用Typescript编码的时候出现了如下错误提示:TSLint: object access via string literals is disallowed(no-string-literal)禁止通过字符串访问对象。错误代码:this.phoneNumber = this._activateRoute.snapshot.params['phone_number'];解决方案:1、禁...
Angular clipboard
2020年05月15日
这篇文章详细的讲解了angular clipboard的使用方法,文章地址:Use the new Angular Clipboard CDK to interact with the clipboard