0

My template is dynamically derived from the complex rules driven from the Java layer.

Is there a way to dynamically set or update a component's template on ngOnInit for instance or wherever appropriate?

Mini Bhati
  • 343
  • 5
  • 20
  • You can check this answer http://stackoverflow.com/questions/39782409/angular-2-stable-templateurl-variable or this http://stackoverflow.com/questions/39410355/how-to-use-variable-to-define-templateurl-in-angular2 – yurzui Oct 12 '16 at 19:00
  • yurzui - how does the template binding work in the newly created component? both examples are close - except that i needed the newly created component to have input and output ideally from the parent component. – user1143933 Oct 13 '16 at 01:36

1 Answers1

0

Angular2 allows the component's template to be pointed to a file.

@Component({
    selector: 'mycomponent',
    templateUrl: 'views/mycomponent.html'
})

You can make it point to a dynamically generated page instead.

Jonas Arcangel
  • 2,085
  • 11
  • 55
  • 85