diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-12-09 18:03:41 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-12-09 18:04:52 -0500 |
commit | 24e9e8530fe5b7ee4a6da37b5da7a1b66eb5b467 (patch) | |
tree | ebb8f3c5e0195fa7b4f19254cd07d8e4769b1b49 /recipeBuddy/src | |
parent | c37cbf8fbdb48ce8fc14a76ded2ff5401d7bae4d (diff) |
Add routing to main page after sumbitting
Diffstat (limited to 'recipeBuddy/src')
-rw-r--r-- | recipeBuddy/src/app/add-recipe/add-recipe.component.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/recipeBuddy/src/app/add-recipe/add-recipe.component.ts b/recipeBuddy/src/app/add-recipe/add-recipe.component.ts index 407997c..8f00146 100644 --- a/recipeBuddy/src/app/add-recipe/add-recipe.component.ts +++ b/recipeBuddy/src/app/add-recipe/add-recipe.component.ts @@ -7,6 +7,8 @@ import { FormArray } from '@angular/forms'; import { Validators } from '@angular/forms'; +import { Router } from '@angular/router'; + import { Recipe } from '../DataModels/recipe'; import { Ingredient } from '../DataModels/ingredient' import { Step } from '../DataModels/step'; @@ -43,7 +45,8 @@ export class AddRecipeComponent { }); constructor(private fb: FormBuilder, - private restService: BackendService + private restService: BackendService, + private router: Router, ) { } ngOnInit() { @@ -121,6 +124,7 @@ export class AddRecipeComponent { formData.tags.split(','), //tags formData.photos.split(',') //photos ); - this.restService.createRecipe(recipe).subscribe() + this.restService.createRecipe(recipe).subscribe(); + this.router.navigate(['/']); } } |