1

dynamicform

I want to insert dynamically a form module/component containing the html and formgroup definition. The header/footer/buttons (white) are always the same. Is it possible to start the form-parent (white).

<parent-form dynform="dynamicform"></parent-form>

The parent/dynamic should be able to communicate with each other, the parent is in control.

Michael
  • 1,692
  • 1
  • 17
  • 19
GoNode5
  • 21
  • 1
  • 4

2 Answers2

0

If I understand correctlythe point, what you are looking for is exactly what the Angular2 Router is providing. Check for Routing in the official documentation (e.g. https://angular.io/docs/ts/latest/guide/router.html or https://angular.io/docs/ts/latest/tutorial/toh-pt5.html).

I hope this helps

Picci
  • 16,775
  • 13
  • 70
  • 113
0

The header/footer/buttons (white) are always the same

You could use router-outlet

  1. You define each area (Header, Body, and Footer) as router-outlet, you could specify your root template like below. Notice that, we specifically set the name attribute to header and footer, and leave the main area as it is.

    <router-outlet name='header'></router-outlet>
    <router-outlet></router-outlet>
    <router-outlet name='footer'></router-outlet>
    
  2. You specify what component will be rendered on what router-outlet on your router configuration. Notice, that HeaderComponent has header as the outlet. As you can guess, outlet should match the router-outlet name attribute

    { 
      path: 'pageA', 
      children : [
         {path:'', component: MainBodyComponent},
         {path:'', component: HeaderComponent, outlet:'header'},
         {path:'', component: FooterComponent, outlet:'footer'}
      ] 
    }
    

See this Plunker for more insight.

Michael
  • 1,692
  • 1
  • 17
  • 19
  • Thnx for your answer. I already have this setup but to communicate you need an extra service. I was hoping for a better solution, without an outlet. The child is dump with only the input components. The Parent should have the save buttons and valid control. – GoNode5 Nov 15 '16 at 16:28