Can't bind to 'ngTemplateOutletContext'

As per the docs:

ngTemplateOutletContext bound to NgTemplateOutlet.ngTemplateOutletContext

So you would be able to attach context in the following way:

<ng-container 
  [ngTemplateOutlet]="recursiveList"
  [ngTemplateOutletContext]="{ $implicit: item.childrens }"></ng-container>

Or:

<ng-container *ngTemplateOutlet="recursiveList; context: { $implicit: item.childrens }"></ng-container>

Angular needs to know what view you intend on adding your context object to, so ngTemplateOutletContext won't work on its own AFAIK.

Source, Demo

Tags:

Angular