Created
February 1, 2017 05:06
-
-
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
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
// 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