我想用不同的颜色区分这些值。这是我想做什么的粗略概念。我能够为按钮而不是在桌子上做。当从数据库中检索值时,我想根据diary.level值放置背景颜色。
var app = (function () {
var privateVar = 'hello world';
function sayhelloPrivate() {
console.log(privateVar);
}
function sayhelloPublic() {
console.log(privateVar);
}
// reveal public pointers to
// private functions and properties
return {
sayhello : sayhelloPublic
};
})();
app.sayhello();
//app.sayhelloPrivate(); this will not work as function is private and not visible outside module
angular
.module('app')
.controller('TrackingController', ['$scope', 'Diary', '$state', function($scope, Diary, $state) {
$scope.diaries = [];
$scope.submitForm = function() {
Diary
.upsert({
date: $scope.diary.date,
taken: $scope.diary.taken,
level: $scope.diary.level
})
.$promise
.then(function() {
$state.go('data');
});
};
}])
.controller('DataController', ['$scope', 'Diary', function ($scope, Diary) {
$scope.diaries = Diary.find();
if($scope.diary.level == "1-3.8") {
$scope.buttonClass = "background-color:lightgreen";
}
else if ($scope.diary.level == "4-7") {
$scope.buttonClass = "background-color:tomato";
}
else if ($scope.diary.level == "7.2-10.0") {
$scope.buttonClass = "background-color:purple";
}
else {
$scope.buttonClass = "background-color:yellow";
}
}])
答案 0 :(得分:0)
编写一个辅助函数,可以为日记列表中的每个项调用。
sed -i "s/keywords_extraction/group_knapsack/g" `grep keywords_extraction -rl ./`