私はAngular 2のアニメーション施設を利用しようとしていますが、私は状態に関連付けられたCSSクラスを設定できないようだが、代わりにハードスタイルのコード値を設定する必要があることを発見しました:Angular 2アニメーション状態でCSSクラスを適用できますか?
誰もがこれが可能であるなら、私に知らせることができ@Component({
animations: [
trigger('responseState', [
state('default', style({
class: '.default-state'
})),
state('success', style({
class: '.success-state'
})),
state('error', style({
class: '.error-state'
}))
])
]
})
:私が何を期待していた何
@Component({
animations: [
trigger('responseState', [
state('default', style({
color: '#31708f',
backgroundColor: '#d9edf7',
borderColor: '#bce8f1'
})),
state('success', style({
color: '#3c763d',
backgroundColor: '#dff0d8',
borderColor: '#d6e9c6'
})),
state('error', style({
color: '#a94442',
backgroundColor: '#f2dede',
borderColor: '#ebccd1'
})),
transition('default <=> success', animate('500ms ease-in')),
transition('default <=> error', animate('500ms ease-in')),
transition('error <=> success', animate('500ms ease-in'))
])
]
})
のようなものでしょうか?
クラスを特定の状態に適用するだけの場合は、要素にバインドするのではなくアニメーションAPIを使用する理由を教えてください。 – jonrsharpe
私はいくつか質問を残しましたが、私は利用している状態遷移アニメーションをいくつか持っています。私は質問を更新して、それらを再含める予定です。それは理にかなっていますか? – slashp