小编eye*_*ver的帖子

Angular 2模板 - 方法的安全导航操作符

我正在成功使用angular 2 安全导航操作符作为属性,文档说明属性路径,但方法路径的最佳方法是什么?

myObj?.myMethod().myProperty
Run Code Online (Sandbox Code Playgroud)

给出例外:

EXCEPTION:TypeError:无法在[{{myObj?.myMethod().myProperty}}中读取null的属性'myProperty'

angular2-template angular

7
推荐指数
1
解决办法
6678
查看次数

转到网络服务器 - 不要使用时间戳缓存文件

我正在运行一个用嵌入式系统编写的网络服务器.如果某人降级了固件版本,index.html的时间戳可能会倒退.如果index.html比先前版本旧,则服务器发送http 304响应(未修改),并提供该文件的缓存版本.

Web服务器代码使用http.FileServer()和http.ListenAndServe().

通过使用Posix命令修改index.html的时间戳,可以轻松地重现该问题 touch

touch -d"23:59" index.html
Run Code Online (Sandbox Code Playgroud)

然后重新加载页面

touch -d"23:58" index.html
Run Code Online (Sandbox Code Playgroud)

重新加载这个时间将在index.html上给出304响应.

有没有办法防止基于时间戳的缓存?

webserver caching go

4
推荐指数
1
解决办法
2465
查看次数

标签 统计

angular ×1

angular2-template ×1

caching ×1

go ×1

webserver ×1