Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No provider for EcoFabSpeedDialComponent! #28

Closed
dennisblokland opened this issue Feb 27, 2020 · 5 comments
Closed

No provider for EcoFabSpeedDialComponent! #28

dennisblokland opened this issue Feb 27, 2020 · 5 comments

Comments

@dennisblokland
Copy link

I get this error with angular 9. im on the latest fab-speed-dial version.

ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[EcoFabSpeedDialComponent]: 
  StaticInjectorError(Platform: core)[EcoFabSpeedDialComponent]: 
    NullInjectorError: No provider for EcoFabSpeedDialComponent!
NullInjectorError: StaticInjectorError(AppModule)[EcoFabSpeedDialComponent]: 
  StaticInjectorError(Platform: core)[EcoFabSpeedDialComponent]: 
    NullInjectorError: No provider for EcoFabSpeedDialComponent!
    at NullInjector.get (core.js:1050)
    at resolveToken (core.js:17559)
    at tryResolveToken (core.js:17485)
    at StaticInjector.get (core.js:17300)
    at resolveToken (core.js:17559)
    at tryResolveToken (core.js:17485)
    at StaticInjector.get (core.js:17300)
    at resolveNgModuleDep (core.js:31600)
    at NgModuleRef_.get (core.js:32573)
    at Object.resolveDep (core.js:33132)
    at resolvePromise (zone-evergreen.js:793)
    at resolvePromise (zone-evergreen.js:752)
    at zone-evergreen.js:854
    at ZoneDelegate.invokeTask (zone-evergreen.js:400)
    at Object.onInvokeTask (core.js:40877)
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)
    at Zone.runTask (zone-evergreen.js:168)
    at drainMicroTaskQueue (zone-evergreen.js:570)
    at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:485)
    at invokeTask (zone-evergreen.js:1596)

my imports look like this

imports: [
	  BrowserModule,
	  ***
	  
	  ***
      MatIconModule,
	  ***
	  
	  ***
      EcoFabSpeedDialModule
	  ]
@PowerKiKi
Copy link
Member

I cannot reproduce in a brand new Angular 9.0.3 project, neither in development nor production mode.

The project was created with the following commands, using default answers when needed:

ng new test-fab --minimal
cd test-fab/
yarn add @ecodev/fab-speed-dial
ng add @angular/material

Then the project code was modified as follow to show a basic fab-speed-dial:

diff --git src/app/app.component.ts src/app/app.component.ts
index deaacde..b10841a 100644
--- src/app/app.component.ts
+++ src/app/app.component.ts
@@ -8,6 +8,19 @@ import { Component } from '@angular/core';
       <h1>
         Welcome to {{title}}!
       </h1>
+
+<eco-fab-speed-dial>
+    <eco-fab-speed-dial-trigger>
+        <button mat-fab (click)="doAction('trigger')"><mat-icon>menu</mat-icon></button>
+    </eco-fab-speed-dial-trigger>
+
+    <eco-fab-speed-dial-actions>
+        <button mat-mini-fab (click)="doAction('action1')"><mat-icon>add</mat-icon></button>
+        <button mat-mini-fab (click)="doAction('action2')"><mat-icon>edit</mat-icon></button>
+        <button mat-mini-fab (click)="doAction('action3')"><mat-icon>search</mat-icon></button>
+    </eco-fab-speed-dial-actions>
+</eco-fab-speed-dial>
+
       <span style="display: block">{{ title }} app is running!</span>
       <img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
     </div>
@@ -29,4 +42,5 @@ import { Component } from '@angular/core';
 })
 export class AppComponent {
   title = 'test-fab';
+    public doAction(foo){}
 }
diff --git src/app/app.module.ts src/app/app.module.ts
index de5e54d..66040b1 100644
--- src/app/app.module.ts
+++ src/app/app.module.ts
@@ -3,6 +3,9 @@ import { NgModule } from '@angular/core';
 
 import { AppComponent } from './app.component';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { MatButtonModule } from '@angular/material/button';
+import { MatIconModule } from '@angular/material/icon';
+import { EcoFabSpeedDialModule } from '@ecodev/fab-speed-dial';
 
 @NgModule({
   declarations: [
@@ -10,7 +13,10 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
   ],
   imports: [
     BrowserModule,
-    BrowserAnimationsModule
+    BrowserAnimationsModule,
+    MatButtonModule,
+    MatIconModule,
+    EcoFabSpeedDialModule,
   ],
   providers: [],
   bootstrap: [AppComponent]

Will correctly build:

$ yarn run build 
yarn run v1.22.0
$ ng build
Generating ES5 bundles for differential loading...
ES5 bundle generation complete.

chunk {polyfills} polyfills-es2015.js, polyfills-es2015.js.map (polyfills) 140 kB [initial] [rendered]
chunk {runtime} runtime-es2015.js, runtime-es2015.js.map (runtime) 6.16 kB [entry] [rendered]
chunk {runtime} runtime-es5.js, runtime-es5.js.map (runtime) 6.16 kB [entry] [rendered]
chunk {main} main-es2015.js, main-es2015.js.map (main) 18.9 kB [initial] [rendered]
chunk {main} main-es5.js, main-es5.js.map (main) 20.9 kB [initial] [rendered]
chunk {styles} styles-es2015.js, styles-es2015.js.map (styles) 178 kB [initial] [rendered]
chunk {styles} styles-es5.js, styles-es5.js.map (styles) 179 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 647 kB [initial] [rendered]
chunk {vendor} vendor-es2015.js, vendor-es2015.js.map (vendor) 3.26 MB [initial] [rendered]
chunk {vendor} vendor-es5.js, vendor-es5.js.map (vendor) 3.83 MB [initial] [rendered]
Date: 2020-02-27T09:26:32.447Z - Hash: 1a6f1333e875d48607ed - Time: 35828ms
Done in 39.63s.

What are you doing different than this ?

@dennisblokland
Copy link
Author

i also cannot reproduce in a brand new Angular 9.0.3 project. but i also cant see a big difference. can it be that modules interfere with each other?

@PowerKiKi
Copy link
Member

PowerKiKi commented Feb 27, 2020

Never heard of modules interferences in that way, but who knows...

Did you try to to upgrade everything ?

@dennisblokland
Copy link
Author

I did but that kinda broke everything are the any specific things to update?

@PowerKiKi
Copy link
Member

PowerKiKi commented Feb 27, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants