angularng-bootstrap

How do you get a TemplateRef from a template variable inside another template?


I use NgBoostrap accordion.

And I'm trying to retrieve a TemplateRef that is in an ng-template with @ViewChild . The ng-template is an embedded view created by the ngbAccordionBody directive.

See NgBootstrap GitHub for embedded view creation: ngbAccordionBody

I created a StackBlitz to present my problem.

You'll see that I've found a workaround to my problem.

But I'd like to know if using @ViewChild is possible in this situation. If not, I'd like to know why not.


Solution

  • This problem was indeed a bug in the library. Thanks for the answers.