我想显示日志总数,并使用咆哮声显示日志总数。
但是我希望它也显示在标签中,问题是我不知道如何获取regdata.length以显示视图索引总数。
我是Noob。 youtube没有帮助我,在Switch Case中获取数据对我来说很难,不知道。
//我的索引控制器
var HomeController = function ($s, $mdDialog, service, growl, $linq) {
$s.growl = function (type,count) {
console.log('type',type);
var config = {};
switch (type) {
case "success":
growl.success("Logs Without Problem: " + count, { disableCountDown: true, ttl: 3000 });
break;
case "info":
growl.info("Total logs: " + count, { disableCountDown: true, ttl: 3000 });
break;
default:
growl.error("Logs with Problem: " + count, { disableCountDown: true, ttl: 3000 });
}
}
//Switch Condition
$s.filter = function (d) {
if ($s.mainData) {
switch (d) {
case 'wErr':
$s.regdata = $linq.Enumerable().From($s.mainData).Where(function (x) { return x.OK_Latest == 'No' }).ToArray();
$s.growl('error', $s.regdata.length)
break;
case 'noErr':
$s.regdata = $linq.Enumerable().From($s.mainData).Where(function (x) { return x.OK_Latest == 'Yes' }).ToArray();
$s.growl('success', $s.regdata.length)
break;
case 'def':
$s.regdata = $s.mainData;
$s.growl('info', $s.regdata.length)
break;
}
console.log('req', $s.regdata);
}
}
我在开关盒中有3种情况。分别显示在日志总数中。
答案 0 :(得分:0)
//thank for giving me idea @georgeawg
var init = (function () {
$s.sColumn = '';
$s.reverse = false;
$s.loader = false;
$s.currentTbl = '';
$s.isNulltblNo = [];
$s.isNulltblYes = [];
$s.successCount = 0;
$s.infoCount = 0;
$s.errorCount = 0;
}());
$s.growl = function (type, count) {
console.log('type', type);
var config = {};
switch (type) {
case "success":
growl.success("Logs Without Problem: " + count, { disableCountDown: true, ttl: 3000 });
$s.successCount = count;
break;
case "info":
growl.info("Total logs: " + count, { disableCountDown: true, ttl: 3000 });
$s.infoCount = count;
break;
default:
growl.error("Logs with Problem: " + count, { disableCountDown: true, ttl: 3000 });
$s.errorCount = count;
}
}