stash the length separately

This commit is contained in:
Girish Ramakrishnan
2020-09-14 12:12:39 -07:00
parent 5fca372ddf
commit f114a629f3
2 changed files with 3 additions and 1 deletions

View File

@@ -61,12 +61,14 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
error: {},
blocklist: '',
currentBlocklist: '',
currentBlocklistLength: 0,
refresh: function () {
Client.getBlocklist(function (error, result) {
if (error) return console.error(error);
$scope.blocklist.currentBlocklist = result;
$scope.blocklist.currentBlocklistLength = result.split('\n').filter(function (l) { return l.length !== 0 && l[0] !== '#'; }).length;
});
},