fix(compiler): Query expression lambdas should have dynamic type
Fixes: #9875
This commit is contained in:
parent
9229bbbc80
commit
961c9d48ae
|
@ -6,7 +6,8 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Component, QueryList, ViewChild, ViewChildren} from '@angular/core';
|
import {NgFor} from '@angular/common';
|
||||||
|
import {Component, Directive, QueryList, ViewChild, ViewChildren} from '@angular/core';
|
||||||
|
|
||||||
@Component({selector: 'comp-for-child-query', template: 'child'})
|
@Component({selector: 'comp-for-child-query', template: 'child'})
|
||||||
export class CompForChildQuery {
|
export class CompForChildQuery {
|
||||||
|
@ -21,3 +22,20 @@ export class CompWithChildQuery {
|
||||||
@ViewChild(CompForChildQuery) child: CompForChildQuery;
|
@ViewChild(CompForChildQuery) child: CompForChildQuery;
|
||||||
@ViewChildren(CompForChildQuery) children: QueryList<CompForChildQuery>;
|
@ViewChildren(CompForChildQuery) children: QueryList<CompForChildQuery>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Directive({selector: '[directive-for-query]'})
|
||||||
|
export class DirectiveForQuery {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'comp-with-directive-child',
|
||||||
|
directives: [DirectiveForQuery, NgFor],
|
||||||
|
template: `<div>
|
||||||
|
<div *ngFor="let data of divData" directive-for-query>{{data}}</div>
|
||||||
|
</div>`
|
||||||
|
})
|
||||||
|
export class CompWithDirectiveChild {
|
||||||
|
@ViewChildren(DirectiveForQuery) children: QueryList<DirectiveForQuery>;
|
||||||
|
|
||||||
|
divData: string[];
|
||||||
|
}
|
||||||
|
|
|
@ -105,9 +105,10 @@ function mapNestedViews(
|
||||||
return o.replaceVarInExpression(o.THIS_EXPR.name, o.variable('nestedView'), expr);
|
return o.replaceVarInExpression(o.THIS_EXPR.name, o.variable('nestedView'), expr);
|
||||||
});
|
});
|
||||||
return declarationAppElement.callMethod('mapNestedViews', [
|
return declarationAppElement.callMethod('mapNestedViews', [
|
||||||
o.variable(view.className), o.fn(
|
o.variable(view.className),
|
||||||
|
o.fn(
|
||||||
[new o.FnParam('nestedView', view.classType)],
|
[new o.FnParam('nestedView', view.classType)],
|
||||||
[new o.ReturnStatement(o.literalArr(adjustedExpressions))])
|
[new o.ReturnStatement(o.literalArr(adjustedExpressions))], o.DYNAMIC_TYPE)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue