When your application is in maintenance mode, a custom view will be displayed for all requests into your application.
Some functionality is missing visit wiki-page
To install this library, run :
$ npm install ng-maintainer --save
This module allows you to act on certain things, such as the page title, the body title, the image and a brief description.
First of all, import the interface that will allow you to better adjust the configuration parameters.
import { NgMaintainerConfig } from 'ng-maintainer';
For the following you must define if your application is in maintenance mode.
const config: NgMaintainerConfig = {
maintainerMode: true,
};
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
NgMaintainerModule.forRoot(config)
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
the different parameters are
This parameter is used to activate the maintenance mode.
If you want to change the title of the page at the title tag.
To give a different title to a page in construction or maintenance please use this parameter.
The description part allows to give more information to the user.
You want to use a different image than the default one on the page, this is where it happens.
You can import library in any Angular application by running:
$ npm install ng-maintainer --save
and then from your Angular AppModule:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import your library
import { NgMaintainerModule } from 'ngx-maintainer';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
// Specify your library as an import
NgMaintainerModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
SharedModule
If you use a SharedModule that you import in multiple other feature modules, you can export the NgxPermissionsModule to make sure you don't have to import it in every module.
@NgModule({
exports: [
CommonModule,
NgMaintainerModule
]
})
export class SharedModule { }
Usage in templates
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NgMaintainerModule, NgMaintainerConfig } from 'ng-maintainer';
const config: NgMaintainerConfig = {
maintainerMode: true,
};
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
NgMaintainerModule.forRoot(config)
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Now in your your app.component.ts
import { Component } from '@angular/core';
import {NgMaintainerService} from 'ng-maintainer';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'ngx-maintenance';
constructor(private ngMaintainerService: NgMaintainerService) {
this.ngMaintainerService.listenNavigation();
}
}
MIT © Martian Geeks