angular - Angular项目自己编译/刷新页面
问题描述
几分钟后,我通过运行ng serve
angular cli 编译项目并自行多次刷新页面来运行 angular 项目,尽管代码中没有更新/更改
Date: 2019-07-18T08:23:29.120Z - Hash: 05d5fccc26f4af73d3 - Time: 502ms
14 unchanged chunks
i 「wdm」: Compiled successfully.
i 「wdm」: Compiling...
Date: 2019-07-18T08:28:50.519Z - Hash: 05d5fccc26f4af73d3 - Time: 869ms
14 unchanged chunks
i 「wdm」: Compiled successfully.
i 「wdm」: Compiling...
Date: 2019-07-18T08:47:26.476Z - Hash: 05d5fccc26f4af73d3 - Time: 710ms
14 unchanged chunks
i 「wdm」: Compiled successfully.
angular cli没有错误,只是显示了多个编译日志
解决方案
就我而言,我有一个未处理的 http 请求。一旦我添加了一个异常,问题就停止了。
private handleError(error: HttpErrorResponse) {
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred. Handle it accordingly.
console.error('An error occurred:', error.error.message);
} else {
// The backend returned an unsuccessful response code.
// The response body may contain clues as to what went wrong.
console.error(
`Backend returned code ${error.status}, ` +
`body was: ${error.error}`);
}
// Return an observable with a user-facing error message.
return throwError(
'Something bad happened; please try again later.');
}
// settings
getSettings(): Observable<Settings> {
return this.http.get<Settings>(`${this.localUrl}getSettings`)
.pipe(map(response => response))
.pipe(catchError(this.handleError))
}
推荐阅读
- android - Android Studio 4 获取 RuntimeException 无法实例化活动 ComponentInfo
- tensorflow - 张量流中是否有原生的“MinMaxScaler”?
- python - 在 Python Tkinter 中单击它会打开一个新的 Tk() 窗口的按钮
- kubernetes - 部署入口控制器时 Kubernetes API 超时
- html - Parent node in react-testing-library
- spring-boot - 如何使用 Kubernetes Ingress 执行自定义身份验证
- jquery - HereMap:在位置上悬停时移动地图
- python - 如何从 lambda aws -python 传递电子邮件正文中的变量
- python - Git Bash 没有按 python 2.7.18 的顺序处理我的打印语句和 raw_inputs
- intellij-idea - “将控制台输出保存到日志文件”在 IDEA 中不起作用