This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked the way data and URLs are passed around.
Closes #6 ApiLocation won't be reactive Closes #9 Change ViewData to reactive pattern - added ActivetedView Closes #21 Replace *resource-data directive with simple class Reverts #16 Rename Navigable.go to Navigable.navigate Centerpiece of internal navigation is now ResourceData class (might be renamed later)
- Loading branch information
1 parent
2f3afaf
commit 3098d88
Showing
25 changed files
with
258 additions
and
222 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
<p>See <a href="http://docs.resourcerouterexample.apiary.io/#">API definition</a></p> | ||
|
||
<ng-template [resourceData] let-data [resourceDataOf]="apiLocation.url" | ||
(urlChange)="apiLocation.url=$event"> | ||
<h1>{{data.url}}</h1> | ||
<h1>ROOT</h1> | ||
<h2>{{resource.url}}</h2> | ||
<resource-view [data]="resource.data"></resource-view> | ||
|
||
<h1>*resourceData</h1> | ||
<div *resourceData="let data of apiLocation.url"> | ||
<h2>{{data.url}}</h2> | ||
<resource-view [data]="data"></resource-view> | ||
</ng-template> | ||
</div> | ||
|
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,12 +1,28 @@ | ||
import { Component } from '@angular/core'; | ||
import { ApiLocation } from '../lib/public_api'; | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { ApiLocation, bindUrl, ResourceData } from '../lib/src'; | ||
import { Subscription } from 'rxjs/Subscription'; | ||
|
||
// TODO asi by to chtelo prejmenovat ResourceData, protoze to nepopisuje, co trida dela - drzi location a aktualni data, | ||
// TODO tedy takovy container - pak se da prejmenovat i ViewData.target | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html' | ||
templateUrl: './app.component.html', | ||
providers: [ResourceData] | ||
}) | ||
export class AppComponent { | ||
export class AppComponent implements OnInit, OnDestroy { | ||
|
||
private urlSubscription = Subscription.EMPTY; | ||
|
||
constructor(public apiLocation: ApiLocation, | ||
public resource: ResourceData) { | ||
} | ||
|
||
ngOnInit() { | ||
this.urlSubscription = bindUrl(this.apiLocation, this.resource); | ||
} | ||
|
||
constructor(public apiLocation: ApiLocation) { | ||
ngOnDestroy() { | ||
this.urlSubscription.unsubscribe(); | ||
} | ||
} |
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
Oops, something went wrong.