小编Jul*_*ent的帖子

Angular2 RC5 ngModule:NameService没有提供者

我对angular2服务有一点小问题.我正在尝试使用ngModule提供程序选项提供服务,但是当我尝试将其添加到我的组件中时,我得到了:没有ServiceName的提供程序(此处为RankingService).

app.module.ts

import { NgModule }         from '@angular/core'
import { BrowserModule }    from '@angular/platform-browser'
import { FormsModule }      from '@angular/forms'
import { HttpModule }       from '@angular/http'

/*
 * App component and routing
 */
import { AppComponent } from './components/app/app.component'
import { routing }      from './app.routes'

/*
 * Services
 */
import { UserService }      from './services/user.service'
import { RankingService }   from './services/ranking.service'

/*
 * Global components
 */
import { HeaderComponent }  from './components/header/header.component'
import { FooterComponent }  from './components/footer/footer.component'

/*
 * …
Run Code Online (Sandbox Code Playgroud)

web-applications typescript angular

8
推荐指数
1
解决办法
2643
查看次数

标签 统计

angular ×1

typescript ×1

web-applications ×1