1

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

Community
  • 1
  • 1
Soumya Gangamwar
  • 954
  • 4
  • 16
  • 44
  • http://stackoverflow.com/questions/38888008/how-can-i-use-create-dynamic-template-to-compile-dynamic-component-with-angular/38888009#38888009 – yurzui Jan 18 '17 at 06:48
  • It's not match my case.above plunker link is suitable for my case which I mentioned – Soumya Gangamwar Jan 20 '17 at 04:39

0 Answers0