@Directive({
selector: "ng-template[model]",
standalone: false,
})
export class ViewSelector {
@Input() get model() { return this._model; }
set model(value: Object) {
...
}
@Input("class") set classes(value: string) {
...
}
I'm using this to instantiate views:
<ng-template [model]="model" class="foo bar"></ng-template>
In Angular 11, my directive would get both the 'model' and 'class' inputs, and I would use the class input to copy the class list to the instantated view, without introducing any additional DOM nodes (which complicates styling).
In Angular 19, the class attribute is never hit.
If I change the name to "custom-class" it's hit.
If I change the template code to:
<ng-template [model]="model" [class]="'foo bar'"></ng-template>
It's hit.
But this would require changing a lot of code in the system, and it's less intuitive for developers. The idea is that I can style the node that will be instantiated, using the same syntax as any other node.
Is there a way to restore the old behavior in Angular 19?