Created
November 26, 2014 09:12
-
-
Save adamkleingit/0a08c18d77cf5e8e0e01 to your computer and use it in GitHub Desktop.
Closures for Angular controllers
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
var MyCtrl = (function () { | |
var myDependency; | |
function MyCtrl(_myDependency_){ | |
myDependency = _myDependency_; | |
} | |
MyCtrl.prototype.myFunction = function () { | |
return myDependency.aFunction(); | |
} | |
return MyCtrl; | |
})() | |
angular.module('myApp').controller('myCtrl', MyCtrl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment