How to use the @angular/router.NavigationStart function in @angular/router

To help you get started, we’ve selected a few @angular/router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github citrusframework / citrus-admin / citrus-admin-client / src / main / resources / static / src / app / components / configuration / configuration.component.ts View on Github external
ngOnInit() {
        this.subscription.add(
            this.router.events
                .startWith(new NavigationStart(42, '/configuration'))
                .filter(e => e instanceof NavigationStart)
                .filter((e: NavigationStart) => e.url === '/configuration')
                .subscribe(e => {
                    this.router.navigate(['configuration/endpoints'])
                }))
    }
github opfab / operatorfabric-core / ui / main / src / app / store / effects / custom-router.effects.spec.ts View on Github external
it('should not trigger ClearLightCardSelection if coming from somewhere else', () => {

            const navigation = {
                type: ROUTER_REQUEST,
                payload: {
                    routerState: {
                        url: "/archive"
                    },
                    event: new NavigationStart(1,"/someOtherMenu")
                }
            }

            const localActions$ = new Actions(hot('-a-', { a: navigation}));

            const localExpected = hot('-');

            effects = new CustomRouterEffects(mockStore, localActions$);

            expect(effects).toBeTruthy();
            expect(effects.navigateAwayFromFeed).toBeObservable(localExpected);

        });
github accordproject / concerto / packages / composer-playground / src / app / login / login.component.spec.ts View on Github external
set eventParams(event) {
        let nav;
        if (event.nav === 'end') {
            console.log('MY ONLY FRIEND THE END');
            nav = new NavigationEnd(0, event.url, event.urlAfterRedirects);
        } else {
            nav = new NavigationStart(0, event.url);
        }
        this._eventParams = nav;
        this.subject.next(nav);
    }
github SAP / cloud-commerce-spartacus-storefront / projects / cds / src / profiletag / services / profiletag-events.spec.ts View on Github external
function setVariables() {
    getActiveBehavior = new BehaviorSubject('');
    appendChildSpy = jasmine.createSpy('appendChildSpy');
    getConsentBehavior = new BehaviorSubject([{}]);
    routerEventsBehavior = new BehaviorSubject(
      new NavigationStart(0, 'test.com', 'popstate')
    );
    debugBehavior = new ReplaySubject();
    mockedWindowRef = {
      nativeWindow: {
        addEventListener: (_, listener) => {
          eventListener = listener;
        },
        removeEventListener: jasmine.createSpy('removeEventListener'),
        Y_TRACKING: {
          push: jasmine.createSpy('push'),
        },
      },
      document: {
        createElement: () => ({}),
        getElementsByTagName: () => [{ appendChild: appendChildSpy }],
      },
github digipolisantwerp / acpaas-ui_angular / packages / notifications / lib / src / status-bar / components / status-bar / status-bar.component.spec.ts View on Github external
beforeEach(() => {
			const currentRoute = new NavigationStart(1, '/home');

			routerEvents.next(currentRoute);
		});
github blackbaud / skyux-builder / src / app / app.component.spec.ts View on Github external
setup(skyAppConfig).then(() => {
      fixture.detectChanges();
      subscribeHandler(new NavigationStart(0, ''));
      expect(scrollCalled).toBe(false);

      subscribeHandler(new NavigationEnd(0, '', ''));
      expect(scrollCalled).toBe(true);
    });
  }));
github digipolisantwerp / acpaas-ui_angular / packages / notifications / src / lib / status-bar / components / status-bar / status-bar.component.spec.ts View on Github external
async(inject([Router], (router: RouterStub) => {
				spyOn(comp.clearNotification, 'emit');
				comp.notifications = [{
					message: 'not found',
					handle: '',
					target: '',
					type: '',
					timer: 200,
					scope: 'page',
					clear: () => { },
				}];
				comp.ngOnChanges();
				fixture.detectChanges();

				const newRoute = new NavigationStart(2, '/home');

				router.url = '/home';
				routerEvents.next(newRoute);

				fixture.detectChanges();

				expect(comp.clearNotification.emit).not.toHaveBeenCalled();
			}))
		);
github Alfresco / alfresco-content-app / src / app / components / layout / app-layout / app-layout.component.spec.ts View on Github external
navigate(url: string) {
    const navigationStart = new NavigationStart(0, url);
    this.subject.next(navigationStart);
  }
}
github digipolisantwerp / acpaas-ui_angular / packages / notifications / lib / src / status-bar / components / status-bar / status-bar.component.spec.ts View on Github external
async(inject([Router], (router: RouterStub) => {
				spyOn(comp.clearNotification, 'emit');
				comp.notifications = [{
					message: 'not found',
					handle: '',
					target: '',
					type: '',
					timer: 200,
					scope: 'page',
					clear: () => { },
				}];
				comp.ngOnChanges();
				fixture.detectChanges();

				const newRoute = new NavigationStart(2, '/home');

				router.url = '/home';
				routerEvents.next(newRoute);

				fixture.detectChanges();

				expect(comp.clearNotification.emit).not.toHaveBeenCalled();
			}))
		);