前沿web开发框架
Angular
Angular 是一个开发平台。它能帮你更轻松的构建 Web 应用。Angular 集声明式模板、依赖注入、端到端工具和一些最佳实践于一身,为你解决开发方面的各种挑战。Angular 为开发者提升构建 Web、手机或桌面应用的能力。
A function whose declared type is neither 'void' nor 'any' must return a value.
2019年05月06日
最近使用Observable的方式请求资源,报如下错误:A function whose declared type is neither 'void' nor 'any' must return a value.出现问题的原因:首先看看代码是如何写的:getUserIdByEmail(UserId: string): Observable<any> { const body: stri...
Angular 确认密码验证
2019年04月26日
最近需要在Angular中验证两个密码是否输入相同,具体代码如下:equal-validator.directive.tsimport { Directive, forwardRef, Attribute } from '@angular/core'; import { Validator, AbstractControl, NG_VALIDATORS } from '@angular/form...
Angular 调试表单验证
2019年04月26日
最近在做表单验证的时候,需要调试验证错误,比如:验证密码长度等。如果需要调试Angualr表单验证,使用下面代码:<pre *ngIf="username.errors">{{ username.errors | json }}</pre>之后显示效果如下:看以看到当前输入的字符长度,以及最短长度。参考资料:How to implement custom confirm password vali...
Angular组件核心特性:输入/输出
2019年04月26日
输入/输出<product-list [productList]="products" <!-- input --> (onProductSelected)="productWasSelected($event)"> <!-- output --></product-list>方括号[]...