我想根据我的键值类型为具有“活动”标志的芯片创建一些背光,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;
}