2 | This app is running on the {{ platform }} platform. 3 |
4 | 5 |8 | {{ pizza.description }} 9 |
10 | 11 |#{{ pizza.id }}
{{ pizza.description }}
3 | 4 | Go to details page 5 | 6 | -------------------------------------------------------------------------------- /src/app/pizza/pizza.component.scss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: block; 3 | background: #FAFAFA; 4 | padding: 20px 15px; 5 | border: 1px solid #888; 6 | border-radius: 3px; 7 | width: 400px; 8 | margin: .5em; 9 | } 10 | 11 | h4 { 12 | font-size: 2em; 13 | margin: 0; 14 | padding: 0; 15 | margin-bottom: 10px; 16 | } 17 | -------------------------------------------------------------------------------- /src/app/pizza/pizza.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Pizza } from '../shared/pizza'; 3 | import { Input } from '@angular/core'; 4 | 5 | @Component({ 6 | selector: 'app-pizza', 7 | templateUrl: './pizza.component.html', 8 | styleUrls: ['./pizza.component.scss'] 9 | }) 10 | export class PizzaComponent implements OnInit { 11 | 12 | @Input() pizza: Pizza; 13 | 14 | constructor() { } 15 | 16 | ngOnInit() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/app/shared/pizza.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, PLATFORM_ID, Inject } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable, of } from 'rxjs'; 4 | 5 | import { Pizza } from './pizza'; 6 | import { isPlatformServer, isPlatformBrowser } from '@angular/common'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class PizzaService { 12 | 13 | private apiUrl = 'https://pizza.angular.schule'; 14 | 15 | constructor(private http: HttpClient, @Inject(PLATFORM_ID) private platformId: object) { } 16 | 17 | getAll(): Observable