3 * Copyright (C) 2017-2018 "IoT.bzh"
4 * Author Sebastien Douheret <sebastien@iot.bzh>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
20 import { CommonModule } from '@angular/common';
22 import { NbAuthModule, NbDummyAuthProvider } from '@nebular/auth';
23 import { CookieModule } from 'ngx-cookie';
25 import { throwIfAlreadyLoaded } from './module-import-guard';
26 import { XdsServicesModule } from './services/@core-xds-services.module';
27 import { AnalyticsService } from '../@core/utils/analytics.service';
28 import { StateService } from '../@core/data/state.service';
30 const NB_COREXDS_PROVIDERS = [
31 ...XdsServicesModule.forRoot().providers,
32 ...NbAuthModule.forRoot({
35 service: NbDummyAuthProvider,
52 CookieModule.forRoot(),
59 export class CoreXdsModule {
60 constructor( @Optional() @SkipSelf() parentModule: CoreXdsModule) {
61 throwIfAlreadyLoaded(parentModule, 'CoreXdsModule');
64 static forRoot(): ModuleWithProviders {
65 return <ModuleWithProviders>{
66 ngModule: CoreXdsModule,
68 ...NB_COREXDS_PROVIDERS,