| OLD | NEW |
| (Empty) | |
| 1 part of angular.mock; |
| 2 |
| 3 /* |
| 4 * Use Probe directive to capture the Scope, Injector and Element from any DOM |
| 5 * location into root-scope. This is useful for testing to get a hold of |
| 6 * any directive. |
| 7 * |
| 8 * <div some-directive probe="myProbe">..</div> |
| 9 * |
| 10 * rootScope.myProbe.directive(SomeAttrDirective); |
| 11 */ |
| 12 @NgDirective(selector: '[probe]') |
| 13 class Probe implements NgDetachAware { |
| 14 final Scope scope; |
| 15 final Injector injector; |
| 16 final Element element; |
| 17 final NodeAttrs _attrs; |
| 18 |
| 19 Probe(this.scope, this.injector, this.element, this._attrs) { |
| 20 scope.$root[_attrs['probe']] = this; |
| 21 } |
| 22 |
| 23 detach() => scope.$root[_attrs['probe']] = null; |
| 24 |
| 25 /** |
| 26 * Retrieve a Directive at the current element. |
| 27 */ |
| 28 directive(Type type) => injector.get(type); |
| 29 } |
| 30 |
| OLD | NEW |