Created
May 12, 2015 18:13
-
-
Save NicholasMurray/1706ed6e967fdf79e9a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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