25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
496 B

  1. import { EventEmitter } from "@angular/core";
  2. import { Subject } from "rxjs/Subject";
  3. import { Recipe } from "./recipe.model";
  4. import { Ingredient } from "../shared/ingredient.model";
  5. export class RecipeService {
  6. recipesChanged = new Subject<Recipe[]>();
  7. private recipes: Recipe[] = [];
  8. replaceRecipes(recipes: Recipe[]) {
  9. this.recipes = recipes;
  10. this.recipesChanged.next(this.recipes.slice());
  11. }
  12. getRecipes() {
  13. return this.recipes.slice();
  14. }
  15. }