app.ts 3.29 KB
Newer Older
1 2 3 4
import 'reflect-metadata';
import 'babel-polyfill';
import 'core-js/es6';
import 'core-js/es7/reflect';
5
import { NgModule } from '@angular/core';
6
import { NgReduxModule, DevToolsExtension, NgRedux } from 'ng2-redux';
7
import {BrowserModule} from '@angular/platform-browser';
8
import { CookieModule } from 'ngx-cookie';
9
import { MyDatePickerModule } from 'mydatepicker';
10
import { NguiAutoCompleteModule } from '@ngui/auto-complete';
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
import {
  FormsModule,
  ReactiveFormsModule,
} from '@angular/forms';

import {RouterModule} from '@angular/router';
import { HttpModule } from '@angular/http';
import {
  APP_BASE_HREF,
  HashLocationStrategy,
  LocationStrategy,
  NgLocalization,
} from '@angular/common';

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import Main from './containers/main';
import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from './app.routes';

/* Here we import services */
30
import {HelperDataService} from './services/helper-data-service';
Open Source Developer's avatar
Open Source Developer committed
31
import {LoaderService} from './services/Spinner.service';
32 33
import {AuthService} from './services/auth.service';
import SchoolAuthGuard from './guards/school.auth.guard';
34
import SchoolStudentsLockedGuard from './guards/school.students.locked.guard';
35
import SchoolCapacityLockedGuard from './guards/school.capacity.locked.guard';
36
import StudentAuthGuard from './guards/student.auth.guard';
37
import ReportsAuthGuard from './guards/reports.auth.guard';
38
import StudentLockGuard from './guards/student.lock.guard';
Open Source Developer's avatar
trans  
Open Source Developer committed
39
import RegionEduAuthGuard from './guards/regionedu.auth.guard';
40 41
import EduAdminAuthGuard from './guards/eduadmin.auth.guard';
import MinistryAuthGuard from './guards/ministry.auth.guard';
Open Source Developer's avatar
Open Source Developer committed
42

43
import { ACTION_PROVIDERS } from './actions';
44
import Home from './components/home';
45
import { Ng2SmartTableModule, LocalDataSource } from 'ng2-smart-table';
46 47 48 49 50

import HeaderComponent from './components/header/header.component';
import NavbarComponent from './components/navbar/navbar.component';
import MainComponent from './components/main/main.component';
import FooterComponent from './components/footer/footer.component';
51 52

import {enableProdMode} from '@angular/core';
53

54 55 56 57 58 59 60 61 62 63 64
class MyLocalization extends NgLocalization {
   getPluralCategory(value: any) {
      if (value < 5) {
         return 'few';
      }
   }
}

@NgModule({
  imports:      [
    BrowserModule,
65
    MyDatePickerModule,
66
    FormsModule,
67
    NguiAutoCompleteModule,
68 69 70 71
    RouterModule,
    ReactiveFormsModule,
    APP_ROUTER_PROVIDERS,
    HttpModule,
72
    Ng2SmartTableModule,
Open Source Developer's avatar
Open Source Developer committed
73
    NgReduxModule,
74
    CookieModule.forRoot()
75 76
  ],
  declarations: [
77
    Main, FooterComponent, HeaderComponent, NavbarComponent, MainComponent,
78 79 80 81 82 83 84
    APP_DECLARATIONS,
  ],
  bootstrap: [ Main ],
  providers: [
    { provide: APP_BASE_HREF, useValue: '/' },
    { provide: LocationStrategy, useClass: HashLocationStrategy },
    { provide: NgLocalization, useClass: MyLocalization },
85 86
    DevToolsExtension,
    ACTION_PROVIDERS,
87
    //Service1, again services here
88
    HelperDataService,
Open Source Developer's avatar
Open Source Developer committed
89
    LoaderService,
90 91
    AuthService,
    SchoolAuthGuard,
92
    SchoolStudentsLockedGuard,
93
    SchoolCapacityLockedGuard,
Open Source Developer's avatar
trans  
Open Source Developer committed
94
    StudentAuthGuard,
95
    StudentLockGuard,
96 97
    RegionEduAuthGuard,
    EduAdminAuthGuard,
98 99
    MinistryAuthGuard,
    ReportsAuthGuard
100 101 102 103
  ]
})
class AppModule {}

104
enableProdMode();
105
platformBrowserDynamic().bootstrapModule(AppModule);