Search code examples
dartangular-dartmaterial-components

DomPopupSourceFactory provider error when using material-dropdown-select


I am trying to use material dropdown select but I am getting this error:

EXCEPTION: No provider found for DomPopupSourceFactory.

The materialDirectives is added to the directives list, the html call is simple:

<material-dropdown-select></material-dropdown-select>

I tried the angular_components_example and it worked fine. The problem is with my project. I already tried to clean the .packages and executed the pub get. Nothing worked. I tried some other material components and they worked.


Solution

  • If you add materialProviders to AppComponent it should work:

    @Component(
      selector: 'my-app',
      directives: const <dynamic>[
        CORE_DIRECTIVES,
        materialDirectives,
      ],
      providers: const <dynamic>[
        materialProviders, // <<<<<<<<<<<<<<<<
      ],
    )
    class AppComponent {...}