mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.6 KiB
90 lines
2.6 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { CommonModule } from '@angular/common';
|
|
import { HttpClientModule } from '@angular/common/http';
|
|
import { ApplicationRef, NgModule } from '@angular/core';
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
import { BrowserModule } from '@angular/platform-browser';
|
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
import { RouterModule } from '@angular/router';
|
|
import { AppComponent } from './app.component';
|
|
import { routing } from './app.routes';
|
|
import { ApiUrlConfig, CurrencyConfig, DecimalSeparatorConfig, SqxFrameworkModule, SqxSharedModule, TitlesConfig, UIOptions } from './shared';
|
|
import { SqxShellModule } from './shell';
|
|
|
|
export function configApiUrl() {
|
|
const baseElements = document.getElementsByTagName('base');
|
|
|
|
let baseHref = null;
|
|
|
|
if (baseElements.length > 0) {
|
|
baseHref = baseElements[0].href;
|
|
}
|
|
|
|
if (!baseHref) {
|
|
baseHref = '/';
|
|
}
|
|
|
|
if (baseHref.indexOf(window.location.protocol) === 0) {
|
|
return new ApiUrlConfig(baseHref);
|
|
} else {
|
|
return new ApiUrlConfig(window.location.protocol + '//' + window.location.host + baseHref);
|
|
}
|
|
}
|
|
|
|
export function configUIOptions() {
|
|
return new UIOptions(window['options']);
|
|
}
|
|
|
|
export function configTitles() {
|
|
return new TitlesConfig(undefined, 'Squidex Headless CMS');
|
|
}
|
|
|
|
export function configDecimalSeparator() {
|
|
return new DecimalSeparatorConfig('.');
|
|
}
|
|
|
|
export function configCurrency() {
|
|
return new CurrencyConfig('EUR', '€', true);
|
|
}
|
|
|
|
@NgModule({
|
|
imports: [
|
|
BrowserAnimationsModule,
|
|
BrowserModule,
|
|
CommonModule,
|
|
FormsModule,
|
|
HttpClientModule,
|
|
ReactiveFormsModule,
|
|
RouterModule,
|
|
SqxFrameworkModule.forRoot(),
|
|
SqxSharedModule.forRoot(),
|
|
SqxShellModule,
|
|
routing
|
|
],
|
|
declarations: [
|
|
AppComponent
|
|
],
|
|
providers: [
|
|
{ provide: ApiUrlConfig, useFactory: configApiUrl },
|
|
{ provide: CurrencyConfig, useFactory: configCurrency },
|
|
{ provide: DecimalSeparatorConfig, useFactory: configDecimalSeparator },
|
|
{ provide: TitlesConfig, useFactory: configTitles },
|
|
{ provide: UIOptions, useFactory: configUIOptions }
|
|
],
|
|
entryComponents: [AppComponent]
|
|
})
|
|
export class AppModule {
|
|
public ngDoBootstrap(appRef: ApplicationRef) {
|
|
try {
|
|
appRef.bootstrap(AppComponent);
|
|
} catch (e) {
|
|
console.log('Application element not found');
|
|
}
|
|
}
|
|
}
|