IMPORTANT!
This forum is now archived. Click here for the New Support Forum
How do I create a callback if the main class uses this.
Quote from Ingo on March 22, 2019, 1:29 pmHi,
In my class I have this method
loadPagination(pagination: Pagination) { this.removeAction(); this.loadingIndicator = true; this.customerService.getCustomersPagination(pagination).subscribe( result => this.onPaginationDataLoadSuccessful(result), error => this.onDataLoadFailed(error) ); }I want to create a server that calls this method. My service:
@Injectable() export class PaginationService { private callback: (pagination: Pagination) => void; public setCallback(callback: (pagination: Pagination) => void) { this.callback = callback; } public call() { console.log(this.callback(new Pagination())); } }When the call () service is called I get an exception because this is not the main class.
I have been trying for 2 days now to solve the problem, unfortunately I have not found anything that I can implement.
Regards Ingo
Hi,
In my class I have this method
loadPagination(pagination: Pagination) { this.removeAction(); this.loadingIndicator = true; this.customerService.getCustomersPagination(pagination).subscribe( result => this.onPaginationDataLoadSuccessful(result), error => this.onDataLoadFailed(error) ); }
I want to create a server that calls this method. My service:
@Injectable() export class PaginationService { private callback: (pagination: Pagination) => void; public setCallback(callback: (pagination: Pagination) => void) { this.callback = callback; } public call() { console.log(this.callback(new Pagination())); } }
When the call () service is called I get an exception because this is not the main class.
I have been trying for 2 days now to solve the problem, unfortunately I have not found anything that I can implement.
Regards Ingo
IMPORTANT!
This forum is now archived. Click here for the New Support Forum