Last active
March 11, 2019 08:05
-
-
Save JoseRFJuniorLLMs/ee4013f043e4feb5a9e625f9e0945e03 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component, OnInit } from '@angular/core'; | |
| import {ActivatedRoute} from '@angular/router' | |
| import {RestaurantsService} from '../restaurants/restaurants.service' | |
| import {Restaurant} from '../restaurants/restaurant/restaurant.model' | |
| @Component({ | |
| selector: 'mt-restaurant-detail', | |
| templateUrl: './restaurant-detail.component.html' | |
| }) | |
| export class RestaurantDetailComponent implements OnInit { | |
| restaurant: Restaurant | |
| constructor(private restaurantsService: RestaurantsService, | |
| private route: ActivatedRoute) { } | |
| ngOnInit() { | |
| this.restaurantsService.restaurantById(this.route.snapshot.params['id']) | |
| .subscribe(restaurant => this.restaurant = restaurant) | |
| } | |
| } | |
| ////////////////////////////////XD///////////////////////////////// | |
| import { Component, OnInit } from '@angular/core'; | |
| import {ActivatedRoute} from '@angular/router' | |
| import {RestaurantsService} from '../../restaurants/restaurants.service' | |
| import {Observable} from 'rxjs/Observable' | |
| @Component({ | |
| selector: 'mt-reviews', | |
| templateUrl: './reviews.component.html' | |
| }) | |
| export class ReviewsComponent implements OnInit { | |
| reviews: Observable<any> | |
| constructor(private restaurantsService: RestaurantsService, | |
| private route: ActivatedRoute) { } | |
| ngOnInit() { | |
| this.reviews = this.restaurantsService | |
| .reviewsOfRestaurant(this.route.parent.snapshot.params['id']) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment