我得到这种错误,尽管我从angular2 / core导入的组件应该是它的来源是文件不是通过npm install下载的,或者我的节点需要升级
这是我的档案
import {bootstrap} from 'angular2/platform/browser'; import {Component,View} from 'angular2/core'; @Component({ })
解决方法
在组件后面定义一个类.
import {bootstrap} from 'angular2/platform/browser'; import {Component,View} from 'angular2/core'; @Component({ }) class MyClass { }
@Component只是一个包含该类元数据的装饰器.换句话说,它只是以更优雅的方式为您的课程定义内容.
The @Component function takes the configuration object and turns it into Metadata that it attaches to the component class deFinition. Angular discovers this Metadata at runtime and thus kNows how to do “the right thing”.
原文地址:https://www.jb51.cc/nodejs/241049.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。