Angular 2.0 final: How to instantiate a component from code

后端 未结 4 905
[愿得一人]
[愿得一人] 2021-02-05 16:36

I\'m looking for a way to instantiate a component in Angular2 from within the code of another component. Unlike the many people that have asked a similar question I\'m not so mu

4条回答
  •  无人及你
    2021-02-05 17:09

    You can place your child component inside parent component.

    
      
    
    

    The child component exposes an EventEmitter property with which it emits events when something happens. The parent binds to that event property and reacts to those events. https://angular.io/docs/ts/latest/cookbook/component-communication.html

提交回复
热议问题