Last active
March 18, 2016 07:57
-
-
Save peterheard01/8e4639e23e9bfdc83e28 to your computer and use it in GitHub Desktop.
Test Double : Dummy Object (Javascript)
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
//the real world implementation | |
function Alerter(){ | |
this.alert = (msg){ | |
window.alert(msg); | |
}; | |
} | |
var Alerter = new Alerter(); | |
//the Alerter is injected into here | |
angular.module('app').controller(function(Alerter){ | |
Alerter.alert('hello world'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment