As mentioned by Reno , you can use an injector to enter values.
For completeness, here is an example with the dynamic value "title":
export const TITLE = new InjectionToken<string>('app.title'); @Component({ selector: 'app-item', template: '<p>{{title}}</p>' }) export class TitleComponent { @Input() title:string; constructor(@Inject(TITLE) titleInjected: string){ this.title = this.title || titleInjected; } } @Component({ selector: 'app-foo', template: '<ng-container *ngComponentOutlet="outlet; injector: myInjector"></ng-container>' }) export class FooComponent { outlet = TitleComponent; myInjector: Injector; constructor(injector: Injector){ let title = 'My dynamic title works!'; this.myInjector = ReflectiveInjector.resolveAndCreate([{ provide: TITLE, useValue: title }], injector); } } @NgModule({ providers: [ { provide: TITLE, useValue: '' } ] }) export class AppModule { }
source share