Type 'ConnectionState' is not assignable to type 'boolean'
I am getting this error when I use a function to monitor whether the internet is there or not. Can anyone help me to resolve this error? Here is the app,component.ts file
import { Component } from '@angular/core';
import { ConnectionService, ConnectionState } from 'ng-connection-service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'finalProject';
status = 'ONLINE'; //initializing as online by default
isConnected: ConnectionState = false;
constructor(private connectionService: ConnectionService) {
this.connectionService.monitor().subscribe((isConnected) => {
this.isConnected = isConnected;
if (this.isConnected) {
this.status = 'ONLINE';
} else {
this.status = 'OFFLINE';
}
alert(this.status);
});
}
}import { Component } from '@angular/core';
import { ConnectionService, ConnectionState } from 'ng-connection-service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'finalProject';
status = 'ONLINE'; //initializing as online by default
isConnected: ConnectionState = false;
constructor(private connectionService: ConnectionService) {
this.connectionService.monitor().subscribe((isConnected) => {
this.isConnected = isConnected;
if (this.isConnected) {
this.status = 'ONLINE';
} else {
this.status = 'OFFLINE';
}
alert(this.status);
});
}
}