How to use the @nationalbankbelgium/stark-core.StarkRoutingTransitionHook.ON_SUCCESS function in @nationalbankbelgium/stark-core

To help you get started, we’ve selected a few @nationalbankbelgium/stark-core 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 NationalBankBelgium / stark / packages / stark-ui / src / modules / breadcrumb / components / breadcrumb.component.ts View on Github external
public ngOnInit(): void {
		// if there is not config provided, then it will be automatically constructed based on the router state tree
		if (typeof this.breadcrumbConfig === "undefined") {
			this.breadcrumbConfig = { breadcrumbPaths: this.getPathsFromStateTree() };
			// then refresh the config after every successful transition
			this.deregisterTransitionHook = this.routingService.addTransitionHook(StarkRoutingTransitionHook.ON_SUCCESS, {}, () => {
				this.breadcrumbConfig = { breadcrumbPaths: this.getPathsFromStateTree() };
			});
		}
	}
github NationalBankBelgium / stark / showcase / src / app / app.component.ts View on Github external
this.userService
			.fetchUserProfile()
			.pipe(filter((user?: StarkUser): user is StarkUser => typeof user !== "undefined"))
			.subscribe((user: StarkUser) => {
				this.user = user;
			});

		this.isMenuModeActive = this.breakpointObserver.isMatched([this.mediaQueryMdSm]);

		this.breakpointObserver.observe([this.mediaQueryMdSm]).subscribe((state: BreakpointState) => {
			this.isMenuModeActive = state.matches;
		});

		this.routingService.addTransitionHook(
			StarkRoutingTransitionHook.ON_SUCCESS,
			{
				// match any state except the ones that are children of starkAppInit/starkAppExit or the Ui-Router's root state
				to: (state?: StateObject): boolean => {
					if (state && typeof state.name !== "undefined") {
						const regexInitExitStateName: RegExp = new RegExp("(" + starkAppInitStateName + "|" + starkAppExitStateName + ")");
						return !state.name.match(regexInitExitStateName) && !(state.abstract && state.name === "");
					} else {
						return true; // always match
					}
				}
			},
			(tran: Transition) => {
				const hash: string = tran.targetState().params()["#"];
				if (hash) {
					this.scrollToHash(hash);
				}
github NationalBankBelgium / stark / packages / stark-ui / src / modules / app-menu / components / app-menu-item.component.ts View on Github external
public ngAfterViewInit(): void {
		this.routingTransitionSuccessCallback = this.routingService.addTransitionHook(StarkRoutingTransitionHook.ON_SUCCESS, {}, () => {
			if (this.isCurrentState()) {
				this.isActive = true;
			}
		});

		this.routingTransitionFinishCallback = this.routingService.addTransitionHook(StarkRoutingTransitionHook.ON_FINISH, {}, () => {
			this.isActive = false;
		});
	}
github NationalBankBelgium / stark / packages / stark-ui / src / modules / app-sidebar / components / app-sidebar.component.ts View on Github external
this.onOpenSidenav(event);
		});

		this.closeSidebarSubscription = this.sidebarService.closeSidebar$.subscribe(() => {
			this.onCloseSidenavs();
		});

		this.toggleSidebarSubscription = this.sidebarService.toggleSidebar$.subscribe((event: StarkAppSidebarOpenEvent) => {
			this.onToggleSidenav(event);
		});

		this.breakpointObserver.observe([this.mediaQueryGtLg]).subscribe((state: BreakpointState) => {
			this.onObserveBreakpoints(state);
		});

		this.deregisterTransitionHook = this.routingService.addTransitionHook(StarkRoutingTransitionHook.ON_SUCCESS, {}, () => {
			this.onSuccessfulTransition();
		});
	}