作成したキー値タイプに基づいて「アクティブ」フラグを持つチップのバックライトを作成したいのですが、ng-class="{activeTag: $chip.active}"機能しません。動的に作成された md-chip にこの ng-class を追加する方法。
意見
<md-chips class="custom-chips selected" ng-model="tags" ng-class="{activeTag: $chip.active}" readonly="true">
<md-chip-template style="cursor: pointer;" >
<a ui-sref="">
<strong>{{$chip.id}}</strong>
<em>({{$chip.name}})</em>
</a>
</md-chip-template>
</md-chips>
コントローラ
controller('ChipsController', function($scope) {
$scope.tags = [
{
id: 1,
name: 'Pop',
active: false
},
{
id: 2,
name: 'Rock',
active: true
},
{
id: 3,
name: 'Reggie',
active: false
}
];
});
CSS
.activeTag md-chip{
background: rgba(85, 107, 47, 0.66) !important;
color: white !important;
}