How to put a component inside another component in Angular2?

后端 未结 3 1457
猫巷女王i
猫巷女王i 2021-01-31 02:18

I\'m new at Angular and I\'m still trying to understand it. I\'ve followed the course on the Microsoft Virtual Academy and it was great, but I found a little discrepancy between

3条回答
  •  醉梦人生
    2021-01-31 02:49

    I think in your Angular-2 version directives are not supported in Component decorator, hence you have to register directive same as other component in @NgModule and then import in component as below and also remove directives: [ChildComponent] from decorator.

    import {myDirective} from './myDirective';
    

提交回复
热议问题