New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

network-status-angular

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

network-status-angular

Service for angular 6 to detect if the browser has network connection

latest
npmnpm
Version
1.0.4
Version published
Weekly downloads
42
82.61%
Maintainers
1
Weekly downloads
 
Created
Source

Service for angular 6 to detect if the browser has network connection.

#Instalation

npm install network-status-angular

In app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { NetworkStatusAngularModule } from 'network-status-angular';
 
@NgModule({
  imports: [
    BrowserModule,
    // add NetworkStatusAngularModule in imports
    NetworkStatusAngularModule.forRoot()
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}

Usage

In order to use NetworkStatusService, it's necessary to init in one of your component, for example in app.component.ts.

import { Component } from '@angular/core';
    import { NetworkStatusAngularService } from 'network-status-angular';
    
    @Component({
      selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.css']
    })
    export class AppComponent {
      constructor(private networkStatusAngularService: NetworkStatusAngularService) {
        this.networkStatusAngularService.status.subscribe(status => {
          console.log(status); // returns true if it is online or false if it is offline
        });
      }
    }

Keywords

angular6

FAQs

Package last updated on 20 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts