Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: third_party/pkg/angular/lib/mock/probe.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 part of angular.mock; 1 part of angular.mock;
2 2
3 /* 3 /*
4 * Use Probe directive to capture the Scope, Injector and Element from any DOM 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 5 * location into root-scope. This is useful for testing to get a hold of
6 * any directive. 6 * any directive.
7 * 7 *
8 * <div some-directive probe="myProbe">..</div> 8 * <div some-directive probe="myProbe">..</div>
9 * 9 *
10 * rootScope.myProbe.directive(SomeAttrDirective); 10 * rootScope.myProbe.directive(SomeAttrDirective);
11 */ 11 */
12 @NgDirective(selector: '[probe]') 12 @Decorator(selector: '[probe]')
13 class Probe implements NgDetachAware { 13 class Probe implements DetachAware {
14 final Scope scope; 14 final Scope scope;
15 final Injector injector; 15 final Injector injector;
16 final Element element; 16 final Element element;
17 final NodeAttrs _attrs; 17 String _probeName;
18 18
19 Probe(this.scope, this.injector, this.element, this._attrs) { 19 Probe(this.scope, this.injector, this.element) {
20 scope.rootScope.context[_attrs['probe']] = this; 20 _probeName = element.attributes['probe'];
21 scope.rootScope.context[_probeName] = this;
21 } 22 }
22 23
23 void detach() { 24 void detach() {
24 scope.rootScope.context[_attrs['probe']] = null; 25 scope.rootScope.context[_probeName] = null;
25 } 26 }
26 27
27 /** 28 /**
28 * Retrieve a Directive at the current element. 29 * Retrieve a Directive at the current element.
29 */ 30 */
30 directive(Type type) => injector.get(type); 31 directive(Type type) => injector.get(type);
31 } 32 }
32 33
OLDNEW
« no previous file with comments | « third_party/pkg/angular/lib/mock/module.dart ('k') | third_party/pkg/angular/lib/mock/test_bed.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698