Angular Structure

Overview

Index.html file Structure.

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Judia - Angular 16 Responsive Admin Dashboard Template</title>
    <base href="/">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/x-icon" href="assets/images/favicon.ico">
</head>
<body>
    <app-root></app-root>
</body>
</html>

app.component.html file Structure.

<router-outlet></router-outlet>                                                                         

app-routing.module.ts file Structure.

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { LayoutComponent } from './layouts/layout.component';

// Auth
import { AuthGuard } from './core/guards/auth.guard';

const routes: Routes = [
    { path: '', component: LayoutComponent, loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule), canActivate: [AuthGuard] },
    { path: 'auth', loadChildren: () => import('./account/account.module').then(m => m.AccountModule)  },
    { path: 'pages', loadChildren: () => import('./extraspages/extraspages.module').then(m => m.ExtraspagesModule), canActivate: [AuthGuard] },
];

@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule { }                                                                       

app.module.ts file Structure.

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { AppRoutingModule } from './app-routing.module';
import { LayoutsModule} from "./layouts/layouts.module";

// toaster
import { ToastrModule } from 'ngx-toastr';

// Auth
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS  } from '@angular/common/http';
import { environment } from '../environments/environment';
import { initFirebaseBackend } from './authUtils';
import { FakeBackendInterceptor } from './core/helpers/fake-backend';
import { ErrorInterceptor } from './core/helpers/error.interceptor';
import { JwtInterceptor } from './core/helpers/jwt.interceptor';
import { AngularFireModule } from '@angular/fire/compat';
import { AngularFireAuthModule } from '@angular/fire/compat/auth';

// Store
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { rootReducer } from 'src/app/reducers';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { AuthenticationEffects } from './effects/authentication.effects';

// Language
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';

// Component
import { AppComponent } from './app.component';

export function createTranslateLoader(http: HttpClient): any {
    return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
}

if (environment.defaultauth === 'firebase') {
    initFirebaseBackend(environment.firebaseConfig);
} else {
    FakeBackendInterceptor;
}

@NgModule({
    declarations: [
    AppComponent
    ],
    imports: [
    TranslateModule.forRoot({
        defaultLanguage: 'en',
        loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [HttpClient]
        }
    }),
    BrowserAnimationsModule,
    HttpClientModule,
    BrowserModule,
    AppRoutingModule,
    LayoutsModule,
    ToastrModule.forRoot(),
    StoreModule.forRoot(rootReducer),
    StoreDevtoolsModule.instrument({
      maxAge: 25, // Retains last 25 states
      logOnly: environment.production, // Restrict extension to log-only mode
    }),
    EffectsModule.forRoot([AuthenticationEffects]),
    AngularFireModule.initializeApp(environment.firebaseConfig),
    AngularFireAuthModule
    ],
    providers: [
    { provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
    { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
    { provide: HTTP_INTERCEPTORS, useClass: FakeBackendInterceptor, multi: true },
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }
                                                                                                        

Layout setup

You can set the default layout in the src/app/store/layouts/layout-reducers.ts file.

 export const initialState: LayoutState = {
    LAYOUT_MODE: LAYOUT_MODE_TYPES.LIGHTMODE,
    CARD_LAYOUT: DATA_CARD_LAYOUT_TYPES.BORDERLESS,
    LAYOUT_WIDTH: LAYOUT_WIDTH_TYPES.BOXED,
    LAYOUT_POSITION: LAYOUT_POSITION_TYPES.FIXED,
    TOPBAR: LAYOUT_TOPBAR_COLOR_TYPES.DARK,
    TOPBAR_IMAGE: LEFT_TOPBAR_IMAGE_TYPES.ONE,
    DATA_PRELOADER: PERLOADER_TYPES.DISABLE
  }
Layouts Types
LAYOUT_MODE_TYPES Light , Dark, Brand
DATA_CARD_LAYOUT_TYPES Borderless , Border
LAYOUT_WIDTH_TYPES Fluid, Boxed
LAYOUT_POSITION_TYPES Fixed , Scrollable
LAYOUT_TOPBAR_COLOR_TYPES Light , Dark, Brand
LEFT_TOPBAR_IMAGE_TYPES Pattern-1 , Pattern-2 , Pattern-3
PERLOADER_TYPES Enabled , Disabled
© Judia.
Design & Develop by Themesbrand