If I add a decorator to a component with PrivateComponentLoader, it errors.
But it tells me "You don't have a template", not that "You shouldn't be adding decorators dynamically".
When I do add a temlpate to my decorator, PrivateComponentLoader lets me add it:
@DynamicComponent({
selector: 'dynamic-component',
services: [PrivateComponentLoader, PrivateComponentLocation]
})
class MyDynamic {
constructor(
loader:PrivateComponentLoader,
location:PrivateComponentLocation
) {
loader.load(TestRedDecorator, location);
}
}
@Decorator({
selector: '[red]'
})
@Template({
inline: 'test'
})
export class TestRedDecorator {
constructor(
element:NgElement
) {
element.domElement.style.background = 'red';
}
}
If I add a decorator to a component with PrivateComponentLoader, it errors.
But it tells me "You don't have a template", not that "You shouldn't be adding decorators dynamically".
When I do add a temlpate to my decorator, PrivateComponentLoader lets me add it: