@@ -84,7 +84,7 @@ type BindingsMap<DirectiveT> = Map<
84
84
/** Shorthand for a map between a reference AST node and the entity it's targeting. */
85
85
type ReferenceMap < DirectiveT > = Map <
86
86
Reference ,
87
- Template | Element | { directive : DirectiveT ; node : DirectiveOwner }
87
+ Template | Element | { directive : DirectiveT ; node : Exclude < DirectiveOwner , HostElement > }
88
88
> ;
89
89
90
90
/** Mapping between AST nodes and the directives that have been matched on them. */
@@ -171,7 +171,7 @@ export class R3TargetBinder<DirectiveT extends DirectiveMeta> implements TargetB
171
171
* Perform a binding operation on the given `Target` and return a `BoundTarget` which contains
172
172
* metadata about the types referenced in the template.
173
173
*/
174
- bind ( target : Target ) : BoundTarget < DirectiveT > {
174
+ bind ( target : Target < DirectiveT > ) : BoundTarget < DirectiveT > {
175
175
if ( ! target . template && ! target . host ) {
176
176
throw new Error ( 'Empty bound targets are not supported' ) ;
177
177
}
@@ -229,9 +229,10 @@ export class R3TargetBinder<DirectiveT extends DirectiveMeta> implements TargetB
229
229
// Bind the host element in a separate scope. Note that it only uses the
230
230
// `TemplateBinder` since directives don't apply inside a host context.
231
231
if ( target . host ) {
232
+ directives . set ( target . host . node , target . host . directives ) ;
232
233
TemplateBinder . applyWithScope (
233
- target . host ,
234
- Scope . apply ( target . host ) ,
234
+ target . host . node ,
235
+ Scope . apply ( target . host . node ) ,
235
236
expressions ,
236
237
symbols ,
237
238
nestingLevel ,
@@ -1029,7 +1030,7 @@ class R3BoundTarget<DirectiveT extends DirectiveMeta> implements BoundTarget<Dir
1029
1030
private deferredScopes : Map < DeferredBlock , Scope > ;
1030
1031
1031
1032
constructor (
1032
- readonly target : Target ,
1033
+ readonly target : Target < DirectiveT > ,
1033
1034
private directives : MatchedDirectives < DirectiveT > ,
1034
1035
private eagerDirectives : DirectiveT [ ] ,
1035
1036
private missingDirectives : Set < string > ,
@@ -1217,7 +1218,8 @@ class R3BoundTarget<DirectiveT extends DirectiveMeta> implements BoundTarget<Dir
1217
1218
if (
1218
1219
target instanceof Template ||
1219
1220
target . node instanceof Component ||
1220
- target . node instanceof Directive
1221
+ target . node instanceof Directive ||
1222
+ target . node instanceof HostElement
1221
1223
) {
1222
1224
return null ;
1223
1225
}
0 commit comments