Encountering an issue with the proper invocation of F5 button or directive call URL from the address bar resulting in ngOnInit not being triggered correctly. Using a debugger to analyze the situation, it was noticed that callHook is not initiated after ngOnInit.
The Angular version in use is 9.1.2
This snippet demonstrates the ngOnInit method:
ngOnInit(): void {
console.log('fired OnInit');
this.dtOptions = {
pagingType : 'full_numbers',
pageLength : 10
};
this.getCurrentUser();
this.initializeList();
this.resetFormData();
}
Furthermore, Ngx-Soap is utilized for database calls with the following service:
import { Injectable } from '@angular/core';
import { Client, ISoapMethodResponse, NgxSoapService } from 'ngx-soap';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Document } from '../_models/document.model';
import { User } from '../_models/user.model';
@Injectable({
providedIn: 'root'
})
export class GeneralService {
client : Client;
xmlResponse : string;
jsonResponse : string;
resultLabel : string;
constructor(
private soap : NgxSoapService
) {
this.soap.createClient(environment.wsURL).then(client=>{
client.addSoapHeader({
'tns:ModuleCredential':{
'tns:ModuleAppName':'xxxx',
'tns:ModuleUserName':'xxxx',
'tns:ModulePassword':'xxxx'
}
});
client.addHttpHeader(
'Content-Type','text/xml; charset=utf-8'
);
this.client = client;
})
.catch(err=>console.log('SoapError',err))
}
Login(formData : User) : Observable<ISoapMethodResponse>{
const body = {
data : formData
};
return this.client.call('Login',body)
}
GetCategoryList():Observable<ISoapMethodResponse>{
const body ={
data:null
};
return this.client.call('GetCategoryList',body);
}
An image captured from the Debugger shows three yellow warnings that were not called post-ngOnInit