Reputation: 220
I want to display the total counts of logs, and I use growl to show the logs total.
but i want it to display it also in label, the problem is I don't have any idea how to get my regdata.length to display the total in view index.
I'm Noob. no YOUTUBE help me neither, getting data inside the Switch Case is hard for me, No idea.
//My Controller for index
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);
}
}
I have 3 condition in switch case.display in view the total logs each.
Upvotes: 0
Views: 75
Reputation: 220
//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;
}
}
Upvotes: 1