diff --git a/modules/angular2/src/core/compiler/element_injector.ts b/modules/angular2/src/core/compiler/element_injector.ts index 9d61a4a60c..ad9aea6c95 100644 --- a/modules/angular2/src/core/compiler/element_injector.ts +++ b/modules/angular2/src/core/compiler/element_injector.ts @@ -658,11 +658,14 @@ export class ElementInjector extends TreeNode implements Depend } private _addViewQueries(host: ElementInjector): void { - if (isPresent(host._query0) && host._query0.originator == host) + if (isPresent(host._query0) && host._query0.originator == host && + host._query0.query.isViewQuery) this._addViewQuery(host._query0); - if (isPresent(host._query1) && host._query1.originator == host) + if (isPresent(host._query1) && host._query1.originator == host && + host._query1.query.isViewQuery) this._addViewQuery(host._query1); - if (isPresent(host._query2) && host._query2.originator == host) + if (isPresent(host._query2) && host._query2.originator == host && + host._query2.query.isViewQuery) this._addViewQuery(host._query2); } diff --git a/modules/angular2/test/core/compiler/query_integration_spec.ts b/modules/angular2/test/core/compiler/query_integration_spec.ts index 2223c31310..0467d3ec05 100644 --- a/modules/angular2/test/core/compiler/query_integration_spec.ts +++ b/modules/angular2/test/core/compiler/query_integration_spec.ts @@ -397,7 +397,10 @@ class TextDirective { } @Component({selector: 'needs-query'}) -@View({directives: [NgFor], template: '
{{dir.text}}|
'}) +@View({ + directives: [NgFor, TextDirective], + template: '
{{dir.text}}|
' +}) @Injectable() class NeedsQuery { query: QueryList;