You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
angularjs-batarang/panel/hints/hints.js

25 lines
782 B
JavaScript

'use strict';
angular.module('batarang.app.hint', []).
controller('HintController', ['$scope', 'inspectedApp', HintController]);
function HintController($scope, inspectedApp) {
$scope.$watch(function () {
return inspectedApp.hints.length;
}, function () {
var newHints = inspectedApp.hints;
$scope.groupedHints = {};
newHints.forEach(function (hint) {
var moduleName = hint.module || 'Hints';
var category = hint.category || (moduleName + ' Stuff');
if (!$scope.groupedHints[moduleName]) {
$scope.groupedHints[moduleName] = {};
}
if (!$scope.groupedHints[moduleName][category]) {
$scope.groupedHints[moduleName][category] = [];
}
$scope.groupedHints[moduleName][category].push(hint);
});
});
}