Created
November 5, 2014 09:42
-
-
Save rolaveric/bc9734c30528e0886bc3 to your computer and use it in GitHub Desktop.
AngularJS v1.3 equivalent of controller replacement in Angular v2.0
This file contains 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
angular.module('myApp', []).directive('myComponent', function() { | |
return { | |
scope: true, | |
controller: function() { | |
this.myProperty = 'myValue'; | |
this.myMethod = function() { | |
return 'myResult'; | |
}; | |
}, | |
controllerAs: 'myComponent' | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment