-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: got demo app to test breadcrumbs
- Loading branch information
1 parent
5d491d7
commit 5dc1acb
Showing
10 changed files
with
57 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
<p>books works!</p> | ||
<div *ngIf="books$ | async as books; else loading"> | ||
<ul> | ||
<li *ngFor="let book of books"> | ||
<a [routerLink]="['/books', book.url[book.url.length-1] ]" [queryParams]="{ pages: book.numberOfPages }">{{book.name}}</a> | ||
</li> | ||
</ul> | ||
</div> | ||
<ng-template #loading>loading ...</ng-template> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { DataService } from '../data.service'; | ||
import { Observable } from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'got-books', | ||
templateUrl: './books.component.html', | ||
styleUrls: ['./books.component.css'] | ||
}) | ||
export class BooksComponent implements OnInit { | ||
|
||
constructor() { } | ||
books$: Observable<any[]> | ||
constructor(private dataService: DataService) { } | ||
|
||
ngOnInit(): void { | ||
this.books$ = this.dataService.getBooks(); | ||
} | ||
|
||
} |
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient, HttpHeaders } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
|
||
const options = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; | ||
|
||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class DataService { | ||
private API = `https://www.anapioficeandfire.com/api`; | ||
|
||
constructor(private http: HttpClient) { } | ||
|
||
getBooks(): Observable<any[]> { | ||
return this.http.get<any[]>(`${this.API}/books`); | ||
} | ||
|
||
getCharacters(): Observable<any[]> { | ||
return this.http.get<any[]>(`${this.API}/characters`); | ||
} | ||
|
||
getHouses(): Observable<any[]> { | ||
return this.http.get<any[]>(`${this.API}/houses`); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
<p>houses works!</p> | ||
<div *ngIf="houses$ | async as houses; else loading"> | ||
<ul> | ||
<li *ngFor="let book of houses"> | ||
{{book.name}} | ||
</li> | ||
</ul> | ||
</div> | ||
<ng-template #loading>loading ...</ng-template> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { DataService } from '../data.service'; | ||
|
||
@Component({ | ||
selector: 'got-houses', | ||
templateUrl: './houses.component.html', | ||
styleUrls: ['./houses.component.css'] | ||
}) | ||
export class HousesComponent implements OnInit { | ||
|
||
constructor() { } | ||
houses$: Observable<any[]> | ||
constructor(private dataService: DataService) { } | ||
|
||
ngOnInit(): void { | ||
this.houses$ = this.dataService.getHouses(); | ||
} | ||
|
||
} |