-
Notifications
You must be signed in to change notification settings - Fork 3
09. Navigation Service
Ali Badakhshan edited this page Apr 15, 2019
·
3 revisions
Angular Navigation Service(routing) is limited to outlets.
We tried a lot to extend Angular Routing. But decided to write our own Navigation Service.
With Narik Navigation Service you can have multiple NavigationProvider.
Everyone is registered by a key and has its own behaviour on navigation request.
For example currently Narik implements two NavigationProvider.
-
NarikRouteNavigationProvider
Acts as Angular Routing. - NarikDialogNavigationProvider Whenever a navigation request received, it displays requested view, in a dialog.
It can be extended with many different NavigationProvider. Like Tab NavigationProvider and...
NavigationService is the manager if NavigationProviders. It collects all provided NavigationProviders and uses then.
Example:
export class test{
@NarikInject(NavigationService)
someMethod()
{
navigationService: NavigationService;
this.navigationService
.navigate(
["../" + this.config.entityKey],
"dialog",
{
relativeTo: this.route
},
data
)
.then((d: DialogRef<any>) => {
d.events
.pipe(filter(x => x.eventType === "ENTITY_UPDATED"))
.subscribe(x => {
this.refresh();
});
});
}
}If you create new NavigationProvider, you should provide it in your module providers.
{
provide: NavigationProvider,
useClass: NewNavigationProvider,
multi: true
}- Getting started
- Documentation
- Architecture & Services
- UI Framework