pams-hude-library
v1.1.4
Published
Only for the demo. Thank you for the (https://www.usefuldev.com/blog/post/publishing-a-library-from-an-angular-cli-project)
Downloads
13
Readme
pams-hude-library
Only for the demo. Thank you for the (https://www.usefuldev.com/blog/post/publishing-a-library-from-an-angular-cli-project)
installing the pams-hude-library
npm i pams-hude-library --save
sample project
import module into your module (ex appmodule)
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { PamsHudeLibraryModule } from 'pams-hude-library';
@NgModule({
declarations: [
],
imports: [
PamsHudeLibraryModule,
],
entryComponents: [
],
providers: [
]
})
export class AppModule {}
How to use in angular component (ex HomePage)
import { Component , ChangeDetectorRef} from '@angular/core';
import { NavController } from 'ionic-angular';
import { Subscription } from 'RxJs'
import { HudeClientService, HudeClientStatus} from '../../../node_modules/pams-hude-library/lib/service/hudeclient.service';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
public _hudeclientconnectionstatus:any='';
public _RequestNumber:any='';
private statusConnectionSubscription: Subscription = null;
private imagedataconnectionSubscription: Subscription = null;
constructor(public navCtrl: NavController, public _hudeClientService:HudeClientService, public changeDetect:ChangeDetectorRef) {
}
ngOnInit(): void {
this.statusConnectionSubscription = this._hudeClientService.onConnectionStatusChange().subscribe((data)=>{
switch(data)
{
case HudeClientStatus.CONNECTED:
this._hudeclientconnectionstatus = 'Connected';
break;
case HudeClientStatus.CONNECTING:
this._hudeclientconnectionstatus = 'Connecting';
break;
case HudeClientStatus.DISCONNECTED:
this._hudeclientconnectionstatus = 'Disconnected';
break;
case HudeClientStatus.RECONNECTING:
this._hudeclientconnectionstatus = 'Reconnecting';
break;
}
this.changeDetect.markForCheck();
});
this._hudeClientService.connectToDataServer();
this.imagedataconnectionSubscription = this._hudeClientService.getCurrentImageData().subscribe((data)=>{
this._RequestNumber = data;
this.changeDetect.markForCheck();
});
}
LoadNext(){
this._hudeClientService.loadNextImage('test');
}
ngOnDestroy(): void {
//Disconnect Image Link form Image Enquiry
this._hudeClientService.disconnectFromDataServer();
if (this.statusConnectionSubscription != null)
this.statusConnectionSubscription.unsubscribe();
if (this.imagedataconnectionSubscription != null)
this.imagedataconnectionSubscription.unsubscribe();
}
}