@angular/common#LocationStrategy TypeScript Examples
The following examples show how to use
@angular/common#LocationStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: app.module.ts From angular-electron-admin with Apache License 2.0 | 6 votes |
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
CommonModule,
HttpClientModule,
BrowserAnimationsModule,
AppRoutingModule
],
providers: [
{
provide: LocationStrategy,
useClass: HashLocationStrategy
}
],
bootstrap: [AppComponent]
})
export class AppModule {
}
Example #2
Source File: app.module.ts From client-side-databases with Apache License 2.0 | 6 votes |
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ChatModule
],
providers: [
{ provide: APP_BASE_HREF, useValue: '/' },
{
provide: LocationStrategy,
useClass: PathLocationStrategy
}
],
bootstrap: [AppComponent]
})
export class AppModule { }
Example #3
Source File: app.module.ts From client-side-databases with Apache License 2.0 | 6 votes |
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ChatModule
],
providers: [
{ provide: APP_BASE_HREF, useValue: '/' },
{
provide: LocationStrategy,
useClass: PathLocationStrategy
}
],
bootstrap: [AppComponent]
})
export class AppModule { }
Example #4
Source File: app.module.ts From client-side-databases with Apache License 2.0 | 6 votes |
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ChatModule
],
providers: [
{
provide: APP_INITIALIZER,
useFactory: () => initDatabase,
multi: true,
deps: [/* your dependencies */]
},
DatabaseService,
{ provide: APP_BASE_HREF, useValue: '/' },
{
provide: LocationStrategy,
useClass: PathLocationStrategy
}
],
bootstrap: [AppComponent]
})
export class AppModule { }
Example #5
Source File: app.browser.module.ts From resize-observer with MIT License | 6 votes |
@NgModule({
bootstrap: [AppComponent],
imports: [
CommonModule,
FormsModule,
BrowserModule.withServerTransition({appId: 'demo'}),
AppRoutingModule,
ResizeObserverModule,
ReactiveFormsModule,
],
declarations: [AppComponent],
providers: [
{
provide: LocationStrategy,
useClass: PathLocationStrategy,
},
{
provide: APP_BASE_HREF,
useValue: '',
},
],
})
export class AppBrowserModule {}
Example #6
Source File: app.browser.module.ts From geolocation with MIT License | 6 votes |
@NgModule({
bootstrap: [AppComponent],
imports: [
FormsModule,
BrowserModule.withServerTransition({appId: 'demo'}),
AppRoutingModule,
HighlightModule.forRoot({
languages: hljsLanguages,
}),
],
declarations: [AppComponent, MapComponent],
providers: [
{
provide: LocationStrategy,
useClass: PathLocationStrategy,
},
{
provide: POSITION_OPTIONS,
useValue: {enableHighAccuracy: true, timeout: 3000, maximumAge: 1000},
},
],
})
export class AppBrowserModule {}
Example #7
Source File: app.browser.module.ts From canvas with MIT License | 6 votes |
@NgModule({
bootstrap: [AppComponent],
imports: [
CommonModule,
FormsModule,
CanvasModule,
BrowserModule.withServerTransition({appId: 'demo'}),
AppRoutingModule,
],
declarations: [AppComponent],
providers: [
{
provide: LocationStrategy,
useClass: PathLocationStrategy,
},
{
provide: APP_BASE_HREF,
useValue: '',
},
],
})
export class AppBrowserModule {}
Example #8
Source File: app.providers.ts From ngx-ui-tour with MIT License | 6 votes |
APP_PROVIDERS = [ Title, { provide: HIGHLIGHT_OPTIONS, useValue: HIGHLIGHT_OPTIONS_VALUE }, { provide: LocationStrategy, useClass: PathLocationStrategy }, { provide: TUI_DOC_TITLE, useValue: TITLE_PREFIX }, { provide: TUI_DOC_PAGES, useValue: pages }, { provide: TUI_DOC_DEFAULT_TABS, useValue: DEFAULT_TABS }, { provide: TUI_DOC_LOGO, useValue: LOGO_CONTENT }, { provide: TUI_ANIMATIONS_DURATION, useValue: 300 }, { provide: DELAY_AFTER_NAVIGATION, useValue: 150 } ]
Example #9
Source File: router.module.ts From router with MIT License | 6 votes |
export function provideComponentRouter() {
return [
UrlParser,
{ provide: LocationStrategy, useClass: PathLocationStrategy },
{
provide: QueryParams,
deps: [Router],
useFactory(router: Router) {
return router.queryParams$;
},
},
];
}
Example #10
Source File: app.browser.module.ts From ng-event-plugins with Apache License 2.0 | 6 votes |
@NgModule({
bootstrap: [AppComponent],
imports: [
BrowserModule.withServerTransition({appId: 'demo'}),
EventPluginsModule,
AppRoutingModule,
StaticModule,
HighlightModule,
],
declarations: [AppComponent],
providers: [
{
provide: LocationStrategy,
useClass: PathLocationStrategy,
},
{
provide: APP_BASE_HREF,
useValue: '',
},
{
provide: HIGHLIGHT_OPTIONS,
useValue: {
coreLibraryLoader: () => import('highlight.js/lib/core'),
lineNumbersLoader: () => import('highlightjs-line-numbers.js'), // Optional, only if you want the line numbers
languages: {
typescript: () => import('highlight.js/lib/languages/typescript'),
less: () => import('highlight.js/lib/languages/less'),
xml: () => import('highlight.js/lib/languages/xml'),
},
},
},
],
})
export class AppBrowserModule {}
Example #11
Source File: platform-initializer.service.ts From scion-microfrontend-platform with Eclipse Public License 2.0 | 6 votes |
private getQueryParams(locationStrategy: LocationStrategy): Map<string, string> {
const urlSearchParams: URLSearchParams = (() => {
if (locationStrategy instanceof HashLocationStrategy) {
return new URLSearchParams(window.location.hash.substring(window.location.hash.indexOf('?')));
}
else {
return new URLSearchParams(window.location.search);
}
})();
const queryParams = new Map<string, string>();
urlSearchParams.forEach((value, key) => queryParams.set(key, value));
return queryParams;
}
Example #12
Source File: app.module.ts From dbm with Apache License 2.0 | 6 votes |
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
CommonModule,
HttpClientModule,
BrowserAnimationsModule,
AppRoutingModule
],
providers: [
{
provide: LocationStrategy,
useClass: HashLocationStrategy
},
{provide: NZ_CONFIG, useValue: ngZorroConfig}
],
bootstrap: [AppComponent]
})
export class AppModule {
}
Example #13
Source File: app.module.ts From 1x.ag with MIT License | 6 votes |
@NgModule({
declarations: [
AppComponent,
BaseComponent,
NoContentComponent,
HowItWorksComponent
],
imports: [
BrowserAnimationsModule,
AppRoutingModule,
FormsModule,
NgbModule,
HttpClientModule,
LoadingSpinnerModule,
ModalModule.forRoot(),
DeviceDetectorModule.forRoot(),
NgbToastModule,
ServiceWorkerModule.register('ngsw-worker.js', {
enabled: navigator.userAgent.toLowerCase().indexOf('android') === -1 &&
'serviceWorker' in navigator && environment.production
}),
FontAwesomeModule,
AngularPageVisibilityModule
],
providers: [
{provide: LocationStrategy, useClass: HashLocationStrategy}
],
bootstrap: [AppComponent]
})
export class AppModule {
}
Example #14
Source File: temperature-dragger.component.ts From ngx-admin-dotnet-starter with MIT License | 5 votes |
constructor(
private location: Location,
private locationStrategy: LocationStrategy,
) {
this.oldValue = this.value;
}
Example #15
Source File: room-selector.component.ts From ngx-admin-dotnet-starter with MIT License | 5 votes |
constructor(
private location: Location,
private locationStrategy: LocationStrategy,
private themeService: NbThemeService,
) {
this.selectRoom('2');
}
Example #16
Source File: tiny-mce.component.ts From ngx-admin-dotnet-starter with MIT License | 5 votes |
constructor(
private host: ElementRef,
private locationStrategy: LocationStrategy,
) { }
Example #17
Source File: platform-initializer.service.ts From scion-microfrontend-platform with Eclipse Public License 2.0 | 5 votes |
constructor(private _zone: NgZone, locationStrategy: LocationStrategy, private _messageClientDecorator: NgZoneMessageClientDecorator,
private _intentClientDecorator: NgZoneIntentClientDecorator) {
this._queryParams = this.getQueryParams(locationStrategy);
}
Example #18
Source File: app.module.ts From sba-angular with MIT License | 5 votes |
@NgModule({
imports: [
BrowserModule,
RouterModule.forRoot([]),
FormsModule,
ReactiveFormsModule,
WebServicesModule.forRoot(startConfig),
IntlModule.forRoot(DefaultLocalesConfig),
LoginModule.forRoot(), // Just use default login modal
ModalModule.forRoot(),
],
declarations: [
AppComponent,
],
providers: [
// Provides an APP_INITIALIZER which will fetch application configuration information from the Sinequa
// server automatically at startup using the application name specified in the URL (app[-debug]/<app-name>).
// This allows an application to avoid hard-coding parameters in the StartConfig but requires that the application
// be served from the an app[-debug]/<app name> URL.
// {provide: APP_INITIALIZER, useFactory: StartConfigInitializer, deps: [StartConfigWebService], multi: true},
// Provides the Angular LocationStrategy to be used for reading route state from the browser's URL. Currently
// only the HashLocationStrategy is supported by Sinequa.
{provide: LocationStrategy, useClass: HashLocationStrategy},
// Provides an HttpInterceptor to handle user login. The LoginInterceptor handles HTTP 401 responses
// to Sinequa web service requests and initiates the login process.
{provide: HTTP_INTERCEPTORS, useClass: LoginInterceptor, multi: true},
// Provides an HttpInterceptor that offers a centralized location through which all client-side
// audit records pass. An application can replace AuditInterceptor with a subclass that overrides
// the updateAuditRecord method to add custom audit information to the records.
{provide: HTTP_INTERCEPTORS, useClass: AuditInterceptor, multi: true},
// Provides an HttpInterceptor that automatically processes any notifications specified in the $notifications
// member of the response body to any Sinequa web service requests.
{provide: HTTP_INTERCEPTORS, useClass: NotificationsInterceptor, multi: true},
],
bootstrap: [
AppComponent
]
})
export class AppModule {
}
Example #19
Source File: app.module.ts From sba-angular with MIT License | 5 votes |
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
RouterModule.forRoot(routes),
FormsModule,
ReactiveFormsModule,
WebServicesModule.forRoot(startConfig),
IntlModule.forRoot(AppLocalesConfig),
LoginModule,
ModalModule,
BsSearchModule.forRoot(searchOptions),
BsAutocompleteModule,
BsNotificationModule,
BsFacetModule,
BsActionModule,
BsModalModule,
BsBasketsModule,
BsAlertsModule,
BsSavedQueriesModule,
UtilsModule,
BsLabelsModule,
BsUserSettingsModule,
ResultModule,
BsFeedbackModule,
BsPreviewModule,
MetadataModule,
BsSelectionModule,
BsAdvancedModule
],
declarations: [
AppComponent,
HomeComponent,
SearchComponent,
PreviewComponent,
SearchFormComponent,
AutocompleteExtended
],
providers: [
// Provides an APP_INITIALIZER which will fetch application configuration information from the Sinequa
// server automatically at startup using the application name specified in the URL (app[-debug]/<app-name>).
// This allows an application to avoid hard-coding parameters in the StartConfig but requires that the application
// be served from the an app[-debug]/<app name> URL.
// {provide: APP_INITIALIZER, useFactory: StartConfigInitializer, deps: [StartConfigWebService], multi: true},
// Provides the Angular LocationStrategy to be used for reading route state from the browser's URL. Currently
// only the HashLocationStrategy is supported by Sinequa.
{provide: LocationStrategy, useClass: HashLocationStrategy},
// Provides an HttpInterceptor to handle user login. The LoginInterceptor handles HTTP 401 responses
// to Sinequa web service requests and initiates the login process.
{provide: HTTP_INTERCEPTORS, useClass: LoginInterceptor, multi: true},
// Provides an HttpInterceptor that offers a centralized location through which all client-side
// audit records pass. An application can replace AuditInterceptor with a subclass that overrides
// the updateAuditRecord method to add custom audit information to the records.
{provide: HTTP_INTERCEPTORS, useClass: AuditInterceptor, multi: true},
// Provides an HttpInterceptor that automatically processes any notifications specified in the $notifications
// member of the response body to any Sinequa web service requests.
{provide: HTTP_INTERCEPTORS, useClass: NotificationsInterceptor, multi: true},
{provide: SCREEN_SIZE_RULES, useValue: breakpoints}
],
bootstrap: [
AppComponent
]
})
export class AppModule {
}
Example #20
Source File: admin.module.ts From spurtcommerce with BSD 3-Clause "New" or "Revised" License | 5 votes |
@NgModule({
declarations: [
AdminComponent,
PagerComponent,
EditprofileComponent,
ImagemanagerpopupComponent,
CONTAINERS.AuthLayoutComponent,
CONTAINERS.CommonLayoutComponent
],
imports: [
BrowserModule.withServerTransition({ appId: 'spurtcommerce' }),
DefaultRoutingModule,
PerfectScrollbarModule,
BrowserAnimationsModule,
FormsModule,
ContainersModule,
ComponentsModule,
DefaultCommonModule,
MaterialModule,
CommonModule,
ReactiveFormsModule,
HttpClientModule,
ToastrModule.forRoot(),
ServiceWorkerModule.register('ngsw-worker.js', {
enabled: environment.production
}),
StoreModule.forRoot(reducers, { metaReducers }),
EffectsModule.forRoot([
EditprofileEffect,
OrderstatusEffects,
StockEffects
]),
CKEditorModule,
NgbModule,
NumberAcceptModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
],
providers: [
{
provide: PERFECT_SCROLLBAR_CONFIG,
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
},
{
provide: LocationStrategy,
useClass: HashLocationStrategy
},
ConfigService,
{
provide: HTTP_INTERCEPTORS,
useClass: RequestInterceptor,
multi: true
},
HTTPStatus,
AppApiClient,
AuthGuard,
AuthService,
AuthSandbox,
StockService,
StockSandbox,
EditprofileSandbox,
EditprofileService,
OrderstatusSandbox,
OrderstatusApiClientService
],
bootstrap: [AdminComponent],
entryComponents: [ImagemanagerpopupComponent]
})
export class AdminModule {}
Example #21
Source File: app.module.ts From sba-angular with MIT License | 4 votes |
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
RouterModule.forRoot(routes),
FormsModule,
ReactiveFormsModule,
WebServicesModule.forRoot(startConfig),
IntlModule.forRoot(AppLocalesConfig),
LoginModule,
ModalModule,
BsSearchModule.forRoot(searchOptions),
BsAutocompleteModule,
BsNotificationModule,
BsFacetModule,
BsActionModule,
BsModalModule,
BsBasketsModule,
BsAlertsModule,
BsSavedQueriesModule,
UtilsModule,
BsLabelsModule,
BsUserSettingsModule,
ResultModule,
BsFeedbackModule,
BsPreviewModule,
MetadataModule,
BsSelectionModule,
BsAdvancedModule,
BsHeatmapModule,
BsTimelineModule,
NgxChartsModule,
FusionChartsModule,
VisTimelineModule,
NetworkModule,
GoogleMapsModule,
AgmCoreModule.forRoot({
apiKey: "" // Replace with your own Google Maps API key
}),
FinanceModule,
GridsterModule
],
declarations: [
AppComponent,
SearchComponent,
SearchFormComponent,
AutocompleteExtended,
DashboardItemComponent,
DashboardAddItemComponent
],
providers: [
// Provides an APP_INITIALIZER which will fetch application configuration information from the Sinequa
// server automatically at startup using the application name specified in the URL (app[-debug]/<app-name>).
// This allows an application to avoid hard-coding parameters in the StartConfig but requires that the application
// be served from the an app[-debug]/<app name> URL.
// {provide: APP_INITIALIZER, useFactory: StartConfigInitializer, deps: [StartConfigWebService], multi: true},
// Provides the Angular LocationStrategy to be used for reading route state from the browser's URL. Currently
// only the HashLocationStrategy is supported by Sinequa.
{provide: LocationStrategy, useClass: HashLocationStrategy},
// Provides an HttpInterceptor to handle user login. The LoginInterceptor handles HTTP 401 responses
// to Sinequa web service requests and initiates the login process.
{provide: HTTP_INTERCEPTORS, useClass: LoginInterceptor, multi: true},
// Provides an HttpInterceptor that offers a centralized location through which all client-side
// audit records pass. An application can replace AuditInterceptor with a subclass that overrides
// the updateAuditRecord method to add custom audit information to the records.
{provide: HTTP_INTERCEPTORS, useClass: AuditInterceptor, multi: true},
// Provides an HttpInterceptor that automatically processes any notifications specified in the $notifications
// member of the response body to any Sinequa web service requests.
{provide: HTTP_INTERCEPTORS, useClass: NotificationsInterceptor, multi: true},
{provide: SCREEN_SIZE_RULES, useValue: breakpoints},
{provide: SELECTION_OPTIONS, useValue: selectionOptions}
],
bootstrap: [
AppComponent
]
})
export class AppModule {
}