Updated to Angular 7.x. Thanks Zakir for PR.
Adapted original Tour of Heroes Angular example to use this router. It is missing some features, but take a look at Live Demo.
body: Observable<T> to ActivatedView<T> class, which is same as view.data.subscribe(data => ... = data.body);SingleApiMapper now supports host-relative urls (/api/foobar)npm run buildapp now requires library to be built in dist folder, and tests whether it is AOT compilableObservable operator importsVersion for Angular 5.x, otherwise almost identical with 4.1.1.
DefaultErrorComponent, now it renders html as content instead of codeThis is breaking release, despite it breaks semantic versioning. Its for Angular v4.x applications to allow migration to new model and Angular v5.x
Changed data used in components to reactive pattern, which allows reuse of created view components.
ViewData is no longer available for injection, use ActivatedView instead:
@Component(...)
export class SampleComponent implements OnInit {
public data: MyData;
constructor(public view: ActivatedView<MyData>) {
}
ngOnInit(): void {
this.view.data.subscribe(data => this.data = data.body);
}
}ResourceData directive now needs to be accompanied by [resourceContext] directive:
<div *resourceData="let data of apiLocation" [resourceContext]="data">
<resource-view [data]="data"></resource-view>
</div>Otherwise navigation (resourceLinks) won't work.
Note that navigation internals might change in future releases.
Link interface that describes HAL link.ResourceData class that can be used to programmatically load and navigate resource.[resourceContext] support directive which can provides navigation context for nested components.debugLog that is used when angular does not run in developer mode. This feature will be extended in the future.Bumping to 4.x, to match Angular version. Moved from gulp custom build script to ng-packagr.
Httpbody to responseTyperesponseType now supports only json and text values - blob was buggy in old implementation
and its use would be very rareApiMapper component - there is now ApiUrl and ApiMapper abstract classes,
with default implementations.[resourceLink] should now properly handle external URLs (those that cannot be mapped to an API endpoint)Now compiled with strictNullChecks: true typescript option, which leads to explicit
optional function arguments.
apiLink directive in favour of new resourceLink (which conforms to Angular naming convention)ApiUrl class to ApiMapper (relates to #13)resourceLink is new directive, which fixes navigation problems, page reloads, and works both on <a> (with more features) and other tags like <button> (closes #15)