我的chrome控制台上出现以下错误:
GET http://localhost/grunt/vendor/angular/angular.js net::ERR_CONTENT_LENGTH_MISMATCH
Run Code Online (Sandbox Code Playgroud)
这仅在向nginx发送同时请求时发生,例如当浏览器缓存为空并且整个应用程序加载时.将上面的资源作为单个请求加载成功.
以下是从Chrome复制的此请求的标头:
Remote Address:127.0.0.1:80
Request URL:http://localhost/grunt/vendor/angular/angular.js
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,de;q=0.6,pl;q=0.4,es;q=0.2,he;q=0.2,gl;q=0.2
Cache-Control:no-cache
Connection:keep-alive
Cookie:gs_u_GSN-265185-D=1783247335:2567:5000:1377697930719
Host:localhost
Pragma:no-cache
Referer:http://localhost/grunt/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.122 Safari/537.36
Response Headersview source
Accept-Ranges:bytes
Cache-Control:public, max-age=0
Connection:keep-alive
Content-Length:873444
Content-Type:application/javascript
Date:Tue, 23 Sep 2014 11:08:19 GMT
ETag:"873444-1411465226000"
Last-Modified:Tue, 23 Sep 2014 09:40:26 GMT
Server:nginx/1.6.0
Run Code Online (Sandbox Code Playgroud)
文件的实际大小:
$ ll vendor/angular/angular.js
-rw-rw-r-- 1 xxxx staff 873444 Aug 30 07:21 vendor/angular/angular.js
Run Code Online (Sandbox Code Playgroud)
正如您所看到Content-Length
的,文件的实际大小是相同的,所以这很奇怪
以及此代理的nginx配置: …
我试图通过以下方式使用HTML5功能流式传输音频/ wav:
<audio type="audio/wav" src="/sound/10/audio/full" sound-id="10" version="full" controls="">
</audio>
Run Code Online (Sandbox Code Playgroud)
这在Chrome上运行得很好,除了重放或重新定位currentTime属性这一事实:
var audioElement = $('audio').get(0)
audioElement.currentTime
> 1.2479820251464844
audioElement.currentTime = 0
audioElement.currentTime
> 1.2479820251464844
Run Code Online (Sandbox Code Playgroud)
我正在使用以下代码从Grails控制器提供音频文件:
def audio() {
File file = soundService.getAudio(...)
response.setContentType('audio/wav')
response.setContentLength (file.bytes.length)
response.setHeader("Content-disposition", "attachment;filename=${file.getName()}")
response.outputStream << file.newInputStream() // Performing a binary stream copy
response.status = 206
return false
}
Run Code Online (Sandbox Code Playgroud)
虽然Grails正在回馈HTTP响应200而不是206(部分内容),您可以从Chrome的以下输出中看到:
Request URL:http://localhost:8080/sound/10/audio/full
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:identity;q=1, *;q=0
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Cookie:JSESSIONID=9395D8FFF34B7455F937190F521AA1BC
Host:localhost:8080
Range:bytes=0-3189
Referer:http://localhost:8080/cms/sound/10/edit
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.11 …
Run Code Online (Sandbox Code Playgroud) 考虑具有查询参数的状态的这种情况.我想将它们声明为标志,这样我就可以在控制器中获取并获取true
,false
或者undefined
$stateProvider.state('foo.bar', {
url: '/foobar?flag1&flag2',
templateUrl: 'foo/bar/template.tpl.html',
controller: 'FooBarCtrl'
});
myModule.controller('FooBarCtrl', function($stateParams){
$stateParams.flag1 <<--- is string but can it be of type bool?
$stateParams.flag2 <<--- is string but can it be of type bool?
});
Run Code Online (Sandbox Code Playgroud)
一些URL示例:
/foobar?flag1=true -->> should yield {flag1: true, flag2: undefined}
/foobar?flag2=false -->> should yield {flag1: undefined, flag2: false}
/foobar?flag1=false&flag2=true -->> should yield {flag1: false, flag2: true}
/foobar?flag1=1&flag2=0 -->> should yield {flag1: true, flag2: false}
etc...
Run Code Online (Sandbox Code Playgroud)
目前$ stateParams只提供字符串.有没有让路由器解析params作为标志?这比在控制器中手动解析要优雅得多.
我有以下模板:
<div class='content'>
{{content}}
</div>
Run Code Online (Sandbox Code Playgroud)
以及以下风格:
.content {
margin-top: 30px;
background-color: skyblue;
width: 300px;
transition: all linear 0.5s;
}
Run Code Online (Sandbox Code Playgroud)
请注意,它{{content}}
会增大或缩小(技术上是扩展卡片以显示更多信息或隐藏它)。我已经设置了 css,并且在手动设置不同的元素transition
时它确实有效。height
然而,当注入更多内容时,content
不会进行任何转换,只是简单地调整大小。对正确过渡有什么帮助吗?
请参阅以下 plunkr
谢谢,
阿米特。