【发布时间】:2016-12-01 22:58:32
【问题描述】:
我希望在 angular2 当前版本(V2.2.0)中的另一个组件中使用组件
但之前我们可以选择使用以下代码在另一个组件中使用组件。
import { AnotherComponent } from './another-component';
@Component({
selector: 'my-component',
directives: [AnotherComponent],
template: '<div>Something there<another></another></div>'
})
export class OtherComponent {
}
但是当我尝试相同时它不起作用,它会引发模板编译错误。
现在是否删除了此功能? 或者 还有另一种方法吗?
错误信息
- 如果“导航”是一个 Angular 组件,则验证它是该模块的一部分。
- 如果“导航”是 Web 组件,则将“CUSTOM_ELEMENTS_SCHEMA”添加到该组件的“@NgModule.schemas” 压制此消息。 ("
【问题讨论】:
-
你能添加你的错误信息吗?