【发布时间】:2016-05-04 21:23:50
【问题描述】:
在我描述的here 的问题旁边,我正在尝试一种不同的方法。
作为 AngularJS/Cordova/Ionic 的新手,我希望在单击“Eingepasst”按钮时实现不同的目标,与“Gewonnen”或“Verloren”相比,它具有不同的逻辑(见屏幕截图)。
从我想要实现的最简单的方法开始:我想将“Eingepasst”按钮设置为活动状态,然后将变量“adjustedYesNo”更改为“true”。
这是来自 html 文件的代码:
<div class="padding">
<div class="button-bar">
<button ng-click="round.won=true" ng-class="{'active':round.won == true}" class="button button-outline">Gewonnen</button>
<button ng-click="round.won=false" ng-class="{'active':round.won == false}" class="button button-outline">Verloren</button>
<button ng-click="adjusted()" ng-class="{'active':adjusted.adjustedYesNo() == true}" class="button button-outline">Eingepasst</button>
</div>
</div>
这是controller.js文件的代码:
$scope.adjusted = function (adjustedYesNo)
{
console.log("adjusted before: ", adjustedYesNo);
var adjustedYesNo = false;
console.log("adjusted afterwards: ", adjustedYesNo);
return adjustedYesNo;
}
这里是 CSS 的相关部分:
.button {
border-radius: 10px;
&.button-light {
color: $ci-green;
}
&.button-outline {
@include regular;
color: $ci-white;
border-color: $ci-white;
&.activated {
background-color: rgba($ci-white, .1);
border-color: $ci-white;
}
&.active {
border-color: $ci-white;
background-color: $ci-white;
color: $ci-green;
}
}
那么我需要详细改变什么,当“Eingepasst”按钮没有更改为“Eingepasst”按钮不更改为单击时颜色为“白色”?
【问题讨论】:
标签: javascript html css angularjs sass