当我尝试从angular/http导入HTTP_PROVIDERS时出现此错误:
Error:(3, 9) TS2305: Module '"projectname/node_modules/@angular/http/index"' has no exported member 'HTTP_PROVIDERS'.
Run Code Online (Sandbox Code Playgroud)
这是我的文件内容:
import { Component } from '@angular/core';
import {GithubService} from './services/github.service';
import {HTTP_PROVIDERS} from '@angular/http';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1><Profile></Profile>',
providers: [ HTTP_PROVIDERS, GithubService ]
})
export class AppComponent { }
Run Code Online (Sandbox Code Playgroud)
如果你使用的是> = RC.5添加HttpModule到imports在@NgModule代替:
@NgModule({
imports: [HttpModule],
...
})
class AppModule {}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5788 次 |
| 最近记录: |