Topic: MdbTableService Injection Issues

robjackstewart free asked 5 years ago


Expected behavior Two separate instances of an MdbTablePaginationComponent should receive different instances of MdbTableService when they are in separate modules.

Actual behavior Two separate instances of an MdbTablePaginationComponent receive the same instance of MdbTableService despite being in separate modules with those modules each being resgitered as providers of MdbtableService.

Resources (screenshots, code snippets etc.)

enter image description here

You can see in the attached image that I have a parent module which holds the TabContainerComponent whilst the content of the two tabs are filled with components from different modules, for the sake of the question lets call them Tab1Module and Tab2Module. Each of these modules have a table showing data. For good segregation of responsibility, the table filters, the table itself and the pagination have each been segregated into their own container components (I don't want the pagination to be scrolling along with the table when on mobile). However, due to the MdbTablePaginationComponent requesting an injected instance of the MdbTableService, they both get the same one, resulting in problems with the numbers. Currently the respective service inside each of the tab modules hold all logic, so MdbtableService is injected into both Tab1Service and Tab2Service, however, these also receive the same instance. Am I injecting the table service incorrectly?

I have appended the following code to each of the tab modules however this still does not work:

Tab1Module

 imports: [TableModule]    
 providers: [Tab1Service, MdbTableService],

Tab2Module

imports: [TableModule]    
providers: [Tab2Service, MdbTableService],

Any advice is much appreciated!


Comunicaciones pro commented 5 years ago

Hi, Could you solve it?


Damian Gemza staff answered 5 years ago


Dear @Comunicaciones

This problem should be resolved with the 7.5.0 version of MDB Angular.

Please try to update your project to the latest version of MDB, and check the 7.5.0 changelog for more information about changes in tables.

Best Regards,

Damian


Comunicaciones pro answered 5 years ago


Hi, Is there a solution for this error ?. I have the same problem, we need a solution for this.


Damian Gemza staff answered 5 years ago


Dear robjackstewart,

Thanks for your report. I'm afraid, that you're doing everything right way, and it's a bug in our code.

We have to debug it and look for a fix for this situation. Unfortunately, for now, I'm not able to provide you with more information.

We'll let you know when this problem will be gone.

Best Regards,

Damian



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.4.3
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No
Tags