前沿web开发框架
Angular
Angular 是一个开发平台。它能帮你更轻松的构建 Web 应用。Angular 集声明式模板、依赖注入、端到端工具和一些最佳实践于一身,为你解决开发方面的各种挑战。Angular 为开发者提升构建 Web、手机或桌面应用的能力。
TSLint : variable name must be in camelcase or uppercase
2020年05月15日
最近在使用下划线命名的时候出现了如下错误:TSLint : variable name must be in camelcase or uppercase解决方案:修改tslint.json文件,找到rules下面的variable-name数组,增加:allow-leading-underscore ,来解决此问题。// tslint.json contents { // ... ...
Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
2020年05月14日
今天在使用in-memory-web-api的时候报如下错误:Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class具体截图如下:之后再github找到了答案,具体解决方案如下:My temporary solution was to add: "enableIvy"...
使用Angular in-memory-web-api 无任何数据
2020年05月14日
最近在参照这篇文章,使用in-memory-web-api,模拟获取后端数据,但是怎么也获取不到数据,具体NgModel代码如下: imports: [ BrowserModule, SharedModule, BrowserAnimationsModule, InMemoryWebApiModule.forRoot(InMemoryDataService...
WebStorm .http文件详解
2020年05月14日
最近在使用WebStorm编写Angualr程序的时候,有一个http request,截图如下:通过这个工具我们可以完成绝大部分http请求,是一个不错的post-man替代工具,接下来详细讲讲它如何简化你的操作。请求示例所有HTTP请求需要在后缀为.http的文件中进行,新建一个test.http文件。基本格式为:请求类型(如:GET, POST,PUT) + 请求地址(http://www...
Angular scroll top demo
2020年05月13日
<a class="scroll-to-top" id="backTopBtn" (click)="scrollTop($event)"></a>export class ScrollTopComponent { scrollTop(e) { const scrollToTop = window.setInterval(() => { const pos = wind...
npm audit fix 命令
2020年05月11日
最近需要更新Angular一些安装包,出现了如下提示:found 2 low severity vulnerabilities run `npm audit fix` to fix them, or `npm audit` for details发现两个严重程度较低的漏洞,运行'npm audit fix'进行修复,或者运行'npm audit'查看详情。具体npm audit fix是什么命令...
KeyboardEvent.keyCode deprecated
2020年05月08日
今天在写键盘输入事件的时候,出现了如如下提示:Deprecated symbol used,consult docs for batter alternative截图如下:出现问题的原因:根据MDN,我们绝对应该不使用.keyCode属性,具体文章:KeyboardEvent.keyCode解决方案:var dispatchForCode = function(event, callback) {...
Angular 监控键盘事件
2020年05月08日
下面是在Angular 2中处理键盘事件的一个例子:<input type=text (keypress)="eventHandler($event)"> eventHandler(event) { console.log(event, event.keyCode, event.keyIdentifier); } 如果监控某个键具体事件,示例如下:<input type=text ...