Previously I am using ng-include in Angular1 for dynamic template loading.
Now I started Angular2. Angular2 did n't have ng-include feauture.
By this stackoverflow links I get the solution to that custom directive for this feature
Dynamic template in templatURL in angular2
From solutions for above link post I am facing several issues
I am using Angular2.4.0 version
In above post plunker link is there. If you observe the plunker post there
import {
Component, Input, ViewContainerRef, OnInit, ComponentResolver, ViewChild
} from "@angular/core";
import {FORM_DIRECTIVES} from "@angular/common";
Now I am unable to get FROM_DIRECTIVES from @angular/common and ComponentResolver from @angular/core.because ComponentResolver is replaced ComponentFactoryResolver .
even I make changes to above plunker link I am getting error
caused by: No component factory found for MyNgIncludeContent. Did you add it to @NgModule.entryComponents
Even I add entrycomponents to @NgModule decorator.
Please help me to solve this issue, or suggist any better approach.
You can find my issus on https://plnkr.co/edit/XVLcMl?p=preview