2016-12-28 57 views
0

我一直在尝试在应用程序中添加新文件夹。可以说我已经有组件A和B. 我创建了新的文件夹app/test。在文件夹中创建测试component.ts和我导入它在组分A 我现在越来越例外:组件从Angular 2中的新文件夹导入后出现异常

的观意外指令值“未定义”在测试component.ts我用组分B 。

回答

0

enter image description here

尝试使用这样的事情。

Import {MyComponent} from './app/project/my-component' 

它的工作对我来说我已经贴我的directive.ts的指令文件夹,我把它注册到app.module.ts为

import { HighlightDirective } from './directive/highlight.directive' 

确保您使用单引号,可以有时候会成为问题。

+0

我做到了。在此之前,它是异常没有发现 – EmaRad

+0

更新的答案请检查 –

+0

现在它使用相同的代码:)真的不知道昨天发生了什么 – EmaRad