angular - Can't resolve all parameters for AnalysisComponent: ([object Object], ?, ?, [ -
first of beginner @ angular framework.
when added project's services error.
error: can't resolve parameters analysiscomponent: ([object object], ?, ?, [object object], [object object], [object object], [object object], [object object]).
angular 4.0.0
i cant understand how resolve it.
calendar.component.ts:
import { component, changedetectionstrategy, inject, viewchild, templateref, oninit } '@angular/core'; import { document } '@angular/platform-browser'; import { router } '@angular/router'; import { ngbmodal, modaldismissreasons } '@ng-bootstrap/ng-bootstrap'; import { internservice } '../intern.service'; import { authservice } '../../user/auth.service'; import { toastrservice } '../../common/toastr.service'; import { iintern } '../intern'; import { startofday, endofday, subdays, adddays, endofmonth, issameday, issamemonth, addhours } 'date-fns'; import { subject } 'rxjs/subject'; import { calendarevent, calendareventaction, calendareventtimeschangedevent } 'angular-calendar'; const colors: = { red: { primary: '#ad2121', secondary: '#fae3e3' }, blue: { primary: '#1e90ff', secondary: '#d1e8ff' }, yellow: { primary: '#e3bc08', secondary: '#fdf1ba' } }; export interface ievent { start: date, end: date, title: string, color: { primary: string, secondary: string }, actions: calendareventaction[] } @component({ selector: 'app-fullcalendar', changedetection: changedetectionstrategy.onpush, templateurl: './calendar.component.html', styleurls: ['./calendar.component.scss'] }) export class analysiscomponent implements oninit { @viewchild('modalcontent') modalcontent: templateref<any>; view = 'month'; viewdate: date = new date(); modaldata: { action: string, event: calendarevent }; actions: calendareventaction[] = [{ label: '<i class="editbutton"></i>', onclick: ({ event }: { event: calendarevent }): void => { this.handleevent('edited', event); } }, { label: '<i class="deletebutton"></i>', onclick: ({ event }: { event: calendarevent }): void => { this.events = this.events.filter(ievent => ievent !== event); this.handleevent('deleted', event); } }]; refresh: subject<any> = new subject(); events: calendarevent[] = []; ngoninit() { this.internservice.getinternsbyoption('all') .subscribe(data => { if (data.success === false) { if (data.errcode) { this.authservice.logout(); this.router.navigate(['login']); } this.toastr.error(data.message); } else { console.log(data.data); } }); } activedayisopen = true; constructor(private modal: ngbmodal, private iintern: iintern, private ievent: ievent, private internservice: internservice, private toastr: toastrservice, private router: router, private authservice: authservice, @inject(document) doc: any) { } dayclicked({ date, events }: { date: date, events: calendarevent[] }): void { if (issamemonth(date, this.viewdate)) { if ( (issameday(this.viewdate, date) && this.activedayisopen === true) || events.length === 0 ) { this.activedayisopen = false; } else { this.activedayisopen = true; this.viewdate = date; } } } eventtimeschanged({ event, newstart, newend }: calendareventtimeschangedevent): void { event.start = newstart; event.end = newend; this.handleevent('dropped or resized', event); this.refresh.next(); } handleevent(action: string, event: calendarevent): void { this.modaldata = { event, action }; this.modal.open(this.modalcontent, { size: 'lg' }); } addevent(): void { this.events.push({ title: 'new event', start: startofday(new date()), end: endofday(new date()), color: colors.red, draggable: true, resizable: { beforestart: true, afterend: true } }); this.refresh.next(); } eventcreator(eventintern: iintern) { let = this.ievent; a.start = eventintern.starteddate; a.end = eventintern.endeddate; a.color = colors.red; a.actions = this.actions; this.events.push(a); } }
your problem here:
constructor(private modal: ngbmodal, private iintern: iintern, private ievent: ievent, private internservice: internservice, private toastr: toastrservice, private router: router, private authservice: authservice, @inject(document) doc: any) { }
remove following constructor private iintern: iintern, private ievent: ievent
, @inject(document) doc: any
, i'm not entirely sure doc
being used for?
the line see being used removed items private ievent: ievent
. if require these used varibales, add them top of component so:
export class analysiscomponent implements oninit { public event: ievent; public intern: iintern; public doc: document;
your constructor should this:
constructor(private modal: ngbmodal, private internservice: internservice, private toastr: toastrservice, private router: router, private authservice: authservice) { }
Comments
Post a Comment