10

I am interested how you can obtain a TemplateRef by passing a string for example.

I don't want to obtain it through a component html, as I just want to save it in a config to be used for all components. I am refering to the ng-bootstrap NgbDatePickerConfig that can be viewed here: https://github.com/ng-bootstrap/ng-bootstrap/blob/master/src/datepicker/datepicker-config.ts.

apeshev
  • 197
  • 1
  • 6

1 Answers1

3

As Günter Zöchbauer pointed out, this is not possible and it probably is not too useful as you frequently would want to capture functionality for the template so you will need a Component for that.

However, currently it is not easy to create an isolated component that you just use to get a TemplateRef, as you need a ViewContainerRef in order to do that. Current Angular 2 issue that is targeting that: https://github.com/angular/angular/issues/9293.

apeshev
  • 197
  • 1
  • 6