Skip to content

Instantly share code, notes, and snippets.

@LucaLanziani
Created April 19, 2013 09:32
Show Gist options
  • Save LucaLanziani/5419221 to your computer and use it in GitHub Desktop.
Save LucaLanziani/5419221 to your computer and use it in GitHub Desktop.
AngularApp
.run(["$rootScope", function ($rootScope) {
$rootScope.log_http_response = function (what, callback) {
return function (data, status, headers, config) {
console.log(what, data, status, headers, config);
(callback || angular.noop)(data, status, headers, config);
};
};
$rootScope.message = function () {
var args = Array.prototype.slice.call(arguments);
var message_type = 1;
if (args.length > 1) {
if (angular.isNumber(args[0]) && (args[0] >= 100)) {
var type = args.shift();
message_type = (Math.floor(type/100));
}
}
this.$emit("message", message_type, args.join(" "));
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment