Skip to content

Instantly share code, notes, and snippets.

@NicholasMurray
Created May 12, 2015 18:13
Show Gist options
  • Select an option

  • Save NicholasMurray/1706ed6e967fdf79e9a9 to your computer and use it in GitHub Desktop.

Select an option

Save NicholasMurray/1706ed6e967fdf79e9a9 to your computer and use it in GitHub Desktop.
function Logger() {}
Logger.prototype.log = function(message) {
console.log('Logger: ' + message)
};
function AppLogger() {
Logger.call(this);
this.alert = function(entry) {
alert('Entry: ' + entry)
}
};
AppLogger.prototype = Object.create(Logger.prototype);
app.service('loggerService', AppLogger);
app.controller("customersController", function($scope, customerService, loggerService) {
$scope.customers = customerService.customers;
loggerService.log('customersController logged');
loggerService.alert('customersController alerted');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment