diff options
| author | Igor Minar | 2011-01-24 15:30:28 -0800 | 
|---|---|---|
| committer | Igor Minar | 2011-01-25 20:49:25 -0800 | 
| commit | 9368ea38141b8fda1524fdc34c38ecee16ee2afe (patch) | |
| tree | 958e25b0f6bb68765e9bb97cba1259964107598e /src/Scope.js | |
| parent | a6a4c18ecd9df54f554bca1fd596905acd83585a (diff) | |
| download | angular.js-9368ea38141b8fda1524fdc34c38ecee16ee2afe.tar.bz2 | |
Scope should retrieve $log and $exceptionHandler via $service
- fix $log and $exceptionHandler retrieval
- remove reference to non-existent `error` handler
- update tests
Diffstat (limited to 'src/Scope.js')
| -rw-r--r-- | src/Scope.js | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/src/Scope.js b/src/Scope.js index a8c1322c..0f6dfcf5 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -243,6 +243,7 @@ function createScope(parent, providers, instanceCache) {    parent = Parent.prototype = (parent || {});    var instance = new Parent();    var evalLists = {sorted:[]}; +  var $log, $exceptionHandler;    extend(instance, {      'this': instance, @@ -425,13 +426,13 @@ function createScope(parent, providers, instanceCache) {            return expressionCompile(expression).call(instance);          }        } catch (e) { -        (instance.$log || {error:error}).error(e); +        if ($log) $log.error(e);          if (isFunction(exceptionHandler)) {            exceptionHandler(e);          } else if (exceptionHandler) {            errorHandlerFor(exceptionHandler, e); -        } else if (isFunction(instance.$exceptionHandler)) { -          instance.$exceptionHandler(e); +        } else if (isFunction($exceptionHandler)) { +          $exceptionHandler(e);          }        }      }, @@ -635,5 +636,8 @@ function createScope(parent, providers, instanceCache) {      (instance.$service = createInjector(instance, providers, instanceCache))();    } +  $log = instance.$service('$log'); +  $exceptionHandler = instance.$service('$exceptionHandler'); +    return instance;  } | 
