我正在开发一个必须将项目类设置为活动但无法正常工作的应用程序。它不在ng-repeat列表中。它的4个普通按钮在单击时必须处于活动状态。
答案 0 :(得分:0)
尝试通过ng-class实现此目标,如下所示。
控制器
class PGSQLAlchemy(SQLAlchemy):
def apply_driver_hacks(self, app, info, options):
options.update({
'echo': True,
'connect_args': {
"options": "-c timezone=utc",
}
})
super(PGSQLAlchemy, self).apply_driver_hacks(app, info, options)
db = PGSQLAlchemy()
CSS
var myApp = angular.module('myApp', []);
myApp.controller('myCtrl', function ($scope) {
$scope.isActive = false;
$scope.activeButton = function() {
$scope.isActive = !$scope.isActive;
}
});
HTML
$base: #F8E1C2;
$button: #3D3240;
$button-active: #FF735C;
$margin: 40px;
body {
background: $base;
-webkit-font-smoothing: antialiased;
padding: $margin;
text-align: center;
}
.button {
border: none;
padding: 14px;
color: #fff;
margin: 0 10px;
background: $button;
font-weight: 700;
border-radius: 4px;
}
.active {
background: $button-active;
}
.disabled {
background: #eee;
color: #aaa;
}
答案 1 :(得分:0)
删除活动类名上的单引号,例如从“活动”更改为活动