0
を追加しましたアプリモジュール、これは私が生産アプリを釜しようとすると、私は取得していますエラーですDataServiceのNGビルド--prodは私にエラー
のひとつの宣言を提供します。私はすべてのインポートをチェックし、パラメータはすべて正しいと思われるです。たぶん私は何かを逃しています。すべてのサービスもインポートされます。
ERROR in Error: Can't resolve all parameters for DataService in /Users/avide/WebstormProjects/cocina/cocina.do/src/app/services/data.service.ts: (?, [object Object]).
この
は、DataServiceファイルimport {AppError} from '../common/app-error';
import {NotFoundError} from '../common/not-found-error';
import {BadInput} from '../common/bad-input';
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Http} from '@angular/http';
@Injectable()
export class DataService {
constructor(private url: string, private http: Http) {
}
........
}
これはapp.moduleである
import { UserService } from './services/user.service';
import { FavoriteService } from './services/favorite.service';
import { LikeService } from './services/like.service';
import { PostService } from './services/post.service';
import { SocialService } from './services/social.service';
import { EmailService } from './services/email.service';
import { DataService } from './services/data.service';
import { RecipeService } from './services/recipe.service';
import { AuthService } from './services/auth.service';
import { NotFoundComponent } from './not-found/not-found.component';
import { NoAccessComponent } from './no-access/no-access.component';
import { RecipeFormComponent } from './admin/recipe-form/recipe-form.component';
import { AdminComponent } from './admin/admin/admin.component';
import { RouterModule } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NavbarComponent } from './navbar/navbar.component';
import { HomeComponent } from './home/home.component';
import { EmailFormComponent } from './email-form/email-form.component';
import { RecipeComponent } from './recipe/recipe.component';
import { SearchComponent } from './search/search.component';
import { CategoriesComponent } from './categories/categories.component';
import { LoginFormComponent } from './login-form/login-form.component';
import { SigninFormComponent } from './signin-form/signin-form.component';
import { FilterPipe } from './filter.pipe';
import { CapitalizePipe } from './capitalize.pipe';
import {NgxPaginationModule} from 'ngx-pagination';
import { PostFormComponent } from './admin/post-form/post-form.component';
import { AboutComponent } from './about/about.component';
import { AlertComponent } from './alert/alert.component';
import { LikeComponent } from './like/like.component';
import { FavoriteComponent } from './favorite/favorite.component';
import { ProfileComponent } from './profile/profile.component';
import { BlogComponent } from './blog/blog.component';
import { PostComponent } from './post/post.component';
import {AuthGuard} from './auth.guard';
import {AdminAuthGuard} from './admin-auth.guard';
@NgModule({
declarations: [
AppComponent,
NavbarComponent,
HomeComponent,
EmailFormComponent,
RecipeComponent,
SearchComponent,
CategoriesComponent,
RecipeFormComponent,
LoginFormComponent,
SigninFormComponent,
AdminComponent,
FilterPipe,
CapitalizePipe,
PostFormComponent,
AboutComponent,
AlertComponent,
NoAccessComponent,
NotFoundComponent,
LikeComponent,
FavoriteComponent,
ProfileComponent,
BlogComponent,
PostComponent
],
imports: [
BrowserModule,
HttpModule,
FormsModule,
ReactiveFormsModule,
NgxPaginationModule,
RouterModule.forRoot([
{ path: '', component: HomeComponent},
{ path: 'receta/:categoria/:pais/:id', component: RecipeComponent },
{ path: 'blog/:id', component: PostComponent },
{ path: 'about', component: AboutComponent},
{ path: 'search', component: SearchComponent},
{ path: 'blog', component: BlogComponent },
{ path: 'post', component: BlogComponent },
{ path: 'perfil/:username', component: ProfileComponent, canActivate: [AuthGuard] },
{ path: 'admin/post/new', component: PostFormComponent, canActivate: [AuthGuard, AdminAuthGuard] },
{ path: 'admin/receta/new', component: RecipeFormComponent, canActivate: [AuthGuard, AdminAuthGuard] },
{ path: 'admin/receta/edit/:id', component: RecipeFormComponent, canActivate: [AuthGuard, AdminAuthGuard] },
{ path: 'admin', component: AdminComponent, canActivate: [AuthGuard, AdminAuthGuard] },
{ path: 'login', component: LoginFormComponent },
{ path: 'register', component: SigninFormComponent },
{ path: 'unauthorized', component: NoAccessComponent },
{ path: '**', component: NotFoundComponent }
])
],
providers: [
DataService,
RecipeService,
EmailService,
SocialService,
PostService,
AuthService,
LikeService,
FavoriteService,
UserService,
AuthGuard,
AdminAuthGuard
],
bootstrap: [AppComponent]
})
export class AppModule { }
更新ならびにモジュール情報とポスト。この問題は、** DataServiceの複数のリファレンス**が原因です。 – Aravind
私は 'private url:string'をそこに置くことはできないと思います....それは何ですか? – ewizard
@ewizard DataServiceから拡張された別のサービスからAPIルートを取得する。 – avide