This repository has been archived on 2020-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
angularjs-batarang/panel/hints/hints.js
2014-12-11 11:55:29 -08:00

25 lines
769 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;
if (!$scope.groupedHints[moduleName]) {
$scope.groupedHints[moduleName] = {};
}
if (!$scope.groupedHints[moduleName][category]) {
$scope.groupedHints[moduleName][category] = [];
}
$scope.groupedHints[moduleName][category].push(hint);
});
});
}