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/js/services/appHighlight.js

40 lines
942 B
JavaScript

// Service for highlighting parts of the application
panelApp.factory('appHighlight', function (appContext) {
//TODO: improve look of highlighting; for instance, if an element is bound and a scope,
// you will only see the most recently applied outline
var styles = {
scopes: {
selector: '.ng-scope',
style: 'border: 1px solid red'
},
bindings: {
selector: '.ng-binding',
style: 'border: 1px solid blue'
},
app: {
selector: '[ng-app]',
style: 'border: 1px solid green'
}
};
var api = {};
for (i in styles) {
if (styles.hasOwnProperty(i)) {
// create closure around "styles"
(function () {
var style = styles[i];
api[i] = function (setting) {
if (setting) {
appContext.addCssRule(style);
} else {
appContext.removeCssRule(style);
}
}
}());
}
}
return api;
});