Skip to content

Instantly share code, notes, and snippets.

@kuyseng
Created February 1, 2017 05:06
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 kuyseng/de28f5c321db56df71f907331072cd8c to your computer and use it in GitHub Desktop.
Save kuyseng/de28f5c321db56df71f907331072cd8c to your computer and use it in GitHub Desktop.
delegate method to other object. it's like method programming #define_method in Ruby
// delegate methods to wow-book
angular.forEach([ 'insertPage', 'insertPages', 'insertDoublePage', 'removePages' ],
function(name) {
ctrl[name] = function() { return ctrl.book[name].apply(ctrl.book, arguments) };
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment