diff options
| author | Misko Hevery | 2010-03-22 15:46:34 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-03-22 15:46:34 -0700 |
| commit | b4561ff951ff452e55e820f6f8344dc2668cfd90 (patch) | |
| tree | ca454e5edcf0fbe04a32ff9c950cce9be701e43b /src/Angular.js | |
| parent | 84552f7f8ac3f39c4dbd7d946ae2938d63302840 (diff) | |
| download | angular.js-b4561ff951ff452e55e820f6f8344dc2668cfd90.tar.bz2 | |
ng-repeat works
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/Angular.js b/src/Angular.js index cfffab04..1549e7a7 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -181,15 +181,32 @@ function escapeAttr(html) { function bind(_this, _function) { var curryArgs = slice.call(arguments, 2, arguments.length); - if (!_this) - throw "Missing this"; - if (!_.isFunction(_function)) - throw "Missing function"; return function() { return _function.apply(_this, curryArgs.concat(slice.call(arguments, 0, arguments.length))); }; } +function bindTry(_this, _function) { + var args = arguments, + last = args.length - 1, + curryArgs = slice.call(args, 2, last), + exceptionHandler = args[last]; + return function() { + try { + return _function.apply(_this, curryArgs.concat(slice.call(arguments, 0, arguments.length))); + } catch (e) { + if (e = exceptionHandler(e)) throw e; + } + }; +} + +function errorHandlerFor(element) { + return function(error){ + element.attr('ng-error', angular.toJson(error)); + element.addClass('ng-exception'); + }; +} + function outerHTML(node) { var temp = document.createElement('div'); temp.appendChild(node); |
