refactor(element_injector): renamed Query.directive into Query.selector
This commit is contained in:
parent
c7e48350d3
commit
cd21df3572
|
@ -1,4 +1,4 @@
|
||||||
import {CONST, stringify, isPresent} from 'angular2/src/facade/lang';
|
import {CONST, Type, stringify, isPresent} from 'angular2/src/facade/lang';
|
||||||
import {DependencyAnnotation} from 'angular2/src/di/annotations_impl';
|
import {DependencyAnnotation} from 'angular2/src/di/annotations_impl';
|
||||||
import {resolveForwardRef} from 'angular2/di';
|
import {resolveForwardRef} from 'angular2/di';
|
||||||
|
|
||||||
|
@ -55,12 +55,12 @@ export class Attribute extends DependencyAnnotation {
|
||||||
@CONST()
|
@CONST()
|
||||||
export class Query extends DependencyAnnotation {
|
export class Query extends DependencyAnnotation {
|
||||||
descendants: boolean;
|
descendants: boolean;
|
||||||
constructor(private _directive: any, {descendants = false}: {descendants?: boolean} = {}) {
|
constructor(private _selector:Type, {descendants = false}: {descendants?: boolean} = {}) {
|
||||||
super();
|
super();
|
||||||
this.descendants = descendants;
|
this.descendants = descendants;
|
||||||
}
|
}
|
||||||
|
|
||||||
get directive() { return resolveForwardRef(this._directive); }
|
get selector() { return resolveForwardRef(this._selector); }
|
||||||
|
|
||||||
toString() { return `@Query(${stringify(this.directive)})`; }
|
toString() { return `@Query(${stringify(this.selector)})`; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -897,13 +897,13 @@ export class ElementInjector extends TreeNode<ElementInjector> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _addToQueries(obj, token): void {
|
private _addToQueries(obj, token): void {
|
||||||
if (isPresent(this._query0) && (this._query0.query.directive === token)) {
|
if (isPresent(this._query0) && (this._query0.query.selector === token)) {
|
||||||
this._query0.list.add(obj);
|
this._query0.list.add(obj);
|
||||||
}
|
}
|
||||||
if (isPresent(this._query1) && (this._query1.query.directive === token)) {
|
if (isPresent(this._query1) && (this._query1.query.selector === token)) {
|
||||||
this._query1.list.add(obj);
|
this._query1.list.add(obj);
|
||||||
}
|
}
|
||||||
if (isPresent(this._query2) && (this._query2.query.directive === token)) {
|
if (isPresent(this._query2) && (this._query2.query.selector === token)) {
|
||||||
this._query2.list.add(obj);
|
this._query2.list.add(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1454,8 +1454,8 @@ class QueryRef {
|
||||||
|
|
||||||
visit(inj: ElementInjector, aggregator: any[]): void {
|
visit(inj: ElementInjector, aggregator: any[]): void {
|
||||||
if (isBlank(inj) || !inj._hasQuery(this)) return;
|
if (isBlank(inj) || !inj._hasQuery(this)) return;
|
||||||
if (inj.hasDirective(this.query.directive)) {
|
if (inj.hasDirective(this.query.selector)) {
|
||||||
aggregator.push(inj.get(this.query.directive));
|
aggregator.push(inj.get(this.query.selector));
|
||||||
}
|
}
|
||||||
var child = inj._head;
|
var child = inj._head;
|
||||||
while (isPresent(child)) {
|
while (isPresent(child)) {
|
||||||
|
|
Loading…
Reference in New Issue