How to use the @sitecore-jss/sitecore-jss-angular.isExperienceEditorActive function in @sitecore-jss/sitecore-jss-angular

To help you get started, we’ve selected a few @sitecore-jss/sitecore-jss-angular 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 Sitecore / jss / samples / angular / src / app / routing / jss-route-resolver.service.ts View on Github external
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {
    // in experience editor, we need to reload to avoid confusing the editor ribbon
    if (isExperienceEditorActive() && window) {
      const currentLocation = window.location.pathname + window.location.search + window.location.hash;
      if (currentLocation !== state.url) {
        window.location.assign(state.url);
        return null;
      }
    }

    // route params are created by custom route matcher in app-routing.module
    return this.jssService.changeRoute(route.params.serverRoute, route.params.language);
  }
}

@sitecore-jss/sitecore-jss-angular

This module is provided as a part of Sitecore JavaScript Rendering SDK (JSS). It contains Angular integration components and services for JSS.

Apache-2.0
Latest version published 23 days ago

Package Health Score

57 / 100
Full package analysis

Similar packages