Skip to content

Instantly share code, notes, and snippets.

@alatzl
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alatzl/6451d61ee817fa2b9e14 to your computer and use it in GitHub Desktop.
Save alatzl/6451d61ee817fa2b9e14 to your computer and use it in GitHub Desktop.
Writing Angular with Migration in Mind: Ex. 4
angular.module('myModule')
.directive('roar', function() {
return {
restrict: 'E',
scope: {},
controller: roarCtrl,
controllerAs: dinoRoar,
bindToController: {
dinoType: '@'
}
template: '<p>I am a {{ dinoRoar.getType }}, hear me ROAR!</p>',
};
function roarCtrl() {
this.getType = function() {
return this.dino.species;
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment