1
私のアプリケーションにはカードコンポーネントがあります。どのタイプのカードに基づいているのかは、テンプレートのルート要素に適用する必要がある別のスタイルです。角度 - コンポーネントのルート要素にクラスを適用しないセレクタ
<card class="card-type-class"></card>
私のHTMLはこのように見える終わる:
<card class="card-type-class">
<div class="other-constant-classes">
content of my card
</div>
</card>
の代わりに、このような:
<card>
<div class="other-constant-classes card-type-class">
content of my card
</div>
</card>
は、セレクタからクラスを適用するためにとにかくがあり、私はこれを行うとコンポーネントテンプレートのルート要素?
***申し訳ありませんが、これはあなたが常に文字列としてクラスに渡すことができます...私はその質問を検索する方法を考え出す苦労していた、
属性ベースセレクタは機能しますか? 'セレクタ: '[tn-labelfor]'、'使用法 '
https: /angular.io/docs/ts/latest/guide/attribute-directives.html –