我想知道在使用@HostBinding和host组件的属性之间是否存在巨大的差异(如果存在,是什么?)?
当我使用动画时,我一直在问自己这个问题,因为我在这些情况下(看起来相当接近):
@Component({
selector: 'mycomponent',
animations: [
trigger('myTransition', [
state('inactive', style({
backgroundColor: '#eee',
transform: 'scale(1)'
})),
state('active', style({
backgroundColor: '#cfd8dc',
transform: 'scale(1.1)'
})),
transition('inactive => active', animate('100ms ease-in')),
transition('active => inactive', animate('100ms ease-out'))
])],
host: {
'[@myTransition]': '',
},
})
Run Code Online (Sandbox Code Playgroud)
要么
@Component({
selector: 'mycomponent',
animations: [
trigger('myTransition', [
state('inactive', style({
backgroundColor: '#eee',
transform: 'scale(1)'
})),
state('active', style({
backgroundColor: '#cfd8dc',
transform: 'scale(1.1)'
})),
transition('inactive => active', animate('100ms ease-in')),
transition('active => inactive', animate('100ms ease-out'))
])],
})
export class …Run Code Online (Sandbox Code Playgroud) 我目前正在为用 Go 编写的 REST API 做出贡献,但我面临着一个存在的问题。
我们应该如何处理 PATCH 中的空体?知道 PATCH 用于更新现有数据,我们应该返回错误代码 (4XX) 还是正常状态 (2XX)?
例如,如果我有以下路线: /user/:id
用户具有以下结构:
type User struct {
Name string
Email string
}
Run Code Online (Sandbox Code Playgroud)
因此,如果我们 PATCH 特定用户,我们将有一个包含姓名或电子邮件的正文。
如果它是空的,我们应该怎么做?
RFC5789 不是真正的帮助(错误处理 2.2)