Closed kirtiesl closed 7 years ago
Hum can you share a little project to reproduce the problem please ? Like this I an take a look more quickly. I don't use it anymore on angular 2 as I migrate to 4 so maybe there a compatibility problem.
Here are my file -
1)dashboard-widgets.module.ts
import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { CommonModule } from '@angular/common'; import { MaterialModule } from '@angular/material'; import { DashboardWidgetsComponent } from './dashboard-widgets.component'; import { DashboardWidgetsRoutes } from './dashboard-widgets.routing'; import {Ng2DashboardModule} from 'ngx-dashboard';
@NgModule({ imports: [CommonModule, RouterModule.forChild(DashboardWidgetsRoutes), MaterialModule,Ng2DashboardModule], declarations: [DashboardWidgetsComponent], providers: [] }) export class DashboardWidgetsModule {}
2)dashboard-widgets.component.ts
import {Component, Renderer, ElementRef, forwardRef} from "@angular/core"; import {WidgetComponent} from "ngx-dashboard"; @Component({ selector: 'app-dashboard-widgets', templateUrl: './dashboard-widgets.component.html', providers: [{provide: WidgetComponent, useExisting: forwardRef(() => DashboardWidgetsComponent) }] }) export class DashboardWidgetsComponent extends WidgetComponent{ constructor(ngEl: ElementRef, renderer: Renderer) { super(ngEl, renderer); } }
3)dashboard-widgets.component.html
<widget [size]="[2, 1]">
<div>All other stuff...</div>
WidgetComponent now use Renderer2 not Renderer, try to change your DashboardWidgetsComponent to use Renderer2, maybe it's just that
Also experienced same problem. Changing Renderer didn't help. Changed to Angular4.
@nadir35 same if you have a small project to share it will be helpful :)
I just notice that Renderer2 is not part of angular2, only in angular4 so no way it will work unfortunately :(
I prefer not get back to the now deprecated Renderer class so I prefer leave angular 2 behind, sorry for that please try to upgrade to angular 4
I have integrated ngx-dashboard in angular 2. Getting following error:
EXCEPTION: Uncaught (in promise): Error: Can't resolve all parameters for DashboardComponent: ([object Object], [object Object], ?).
Please suggest.