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/appInspect.js

28 lines
1.0 KiB
JavaScript

// Service for highlighting parts of the application
panelApp.factory('appInspect', function (chromeExtension) {
return {
enable: function () {
chromeExtension.eval(function (window) {
var angular = window.angular;
var popover = angular.element('<div style="position: fixed; left: 10px; top: 10px; z-index: 9999; background-color: white; padding: 10px;"></div>');
angular.element(window.document.body).append(popover);
angular.element('.ng-scope').
on('mouseover', function () {
var thisElt = this;
var thisScope = angular.element(this).scope();
var models = {};
for (prop in thisScope) {
if (thisScope.hasOwnProperty(prop) && prop !== 'this' && prop[0] !== '$') {
models[prop] = thisScope[prop];
}
}
var str = JSON.stringify(models);
console.log(str);
//console.log(thisScope);
popover.html(str);
});
});
}
};
});