Skip to content

Instantly share code, notes, and snippets.

@rolaveric
Created November 5, 2014 09:42
Show Gist options
  • Save rolaveric/bc9734c30528e0886bc3 to your computer and use it in GitHub Desktop.
Save rolaveric/bc9734c30528e0886bc3 to your computer and use it in GitHub Desktop.
AngularJS v1.3 equivalent of controller replacement in Angular v2.0
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