1
当我使用fire base作为数据库运行ionic3应用程序时,出现了该错误。无法解析RecipesService的所有参数
这里recipe.ts的内容文件:
import {Recipe} from "../src/models/recipe";
import {Ingredient} from "../src/models/ingredient";
import {AuthService} from "./auth";
import {Http, Response} from "@angular/http";
import 'rxjs/Rx';
export class RecipesService {
constructor (private authService:AuthService,
private http:Http){}
private recipes: Recipe[] = [];
addRecipe(title: string,
description: string,
difficulty: string,
ingredients: Ingredient[]) {
this.recipes.push(new Recipe(title, description, difficulty, ingredients));
console.log(this.recipes) ;
}
getRecipes() {
return this.recipes.slice();
}
updateRecipe(index: number,
title: string,
description: string,
difficulty: string,
ingredients: Ingredient[]) {
this.recipes[index] = new Recipe(title, description, difficulty, ingredients);
}
removeRecipe(index : number) {
this.recipes.splice(index, 1);
}
storeList(token: string) {
const userId = this.authService.getActiveUser().uid;
return this.http
.put('https://fir-crud-69d01.firebaseio.com/' + userId + '/recipes.json?auth=' + token, this.recipes)
.map((response: Response) => {
return response.json();
});
}
fetchList(token : string){
const userId = this.authService.getActiveUser().uid;
return this.http.get('https://fir-crud-69d01.firebaseio.com/' + userId +'/recipes.json?auth=' + token)
.map((response: Response)=> {
return response.json();
})
.do((recipes:Recipe[])=>{
if(recipes){
this.recipes= recipes;
}else {
this.recipes= []
}
});
}
}
,并从控制台错误:
vendor.js:112012 Uncaught Error: Can't resolve all parameters for RecipesService: (?, ?).
这是正常工作使用recipe.ts文件作为服务器之前将其连接在火力
你注册app.module的供应商阵列在此服务? –