ng-maintainerdeprecated

When your application is in maintenance mode, a custom view will be displayed for all requests into your application.

Usage no npm install needed!

<script type="module">
  import ngMaintainer from 'https://cdn.skypack.dev/ng-maintainer';
</script>

README

contributors npm version

ng-maintainer

When your application is in maintenance mode, a custom view will be displayed for all requests into your application.

Table of contents

Some functionality is missing visit wiki-page

Installation

To install this library, run :

$ npm install ng-maintainer --save

Configuration

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 { }

Parameters

the different parameters are

maintainerMode (boolean)

This parameter is used to activate the maintenance mode.

pageTitle (string)

If you want to change the title of the page at the title tag.

title (string)

To give a different title to a page in construction or maintenance please use this parameter.

description (string)

The description part allows to give more information to the user.

image (string)

You want to use a different image than the default one on the page, this is where it happens.

Consuming library

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();
  }
}

Contributing

Ng-maintainer is an open source, community-driven project. If you'd like to contribute, please read the following contributing guide.

License

Ng-maintainer is open-sourced software licensed under the MIT license © Martian Geeks