Cannot Resolve
rightisleft opened this issue · comments
-
I'm submitting a ...
[X ] bug report
[ ] feature request
[ ] question about the decisions made in the repository -
Do you want to request a feature or report a bug?
This is a new bug
- What is the current behavior?
Has been working fine for a few day. Suddenly started to get:
metadata_resolver.js:499Uncaught Error: Can't resolve all parameters for ToastyService: (?).(…)
-
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar.
-
What is the expected behavior?
The Service is available for DI
-
What is the motivation / use case for changing the behavior?
-
Please tell us about your environment:
angular-cli: 1.0.0-beta.20-4
node: 6.7.0
os: darwin x64
Chrome
- Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { MainComponent } from './main/main.component';
import {appRoutes} from "./app.routes";
import { SourceComponent } from './source/source.component';
import { ReportComponent } from './report/report.component';
import { LensComponent } from './lens/lens.component';
import { HistoryComponent } from './history/history.component';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
import {SourceService} from "./source/source.service";
import {FileUploadComponent} from "./source/upload.component";
import {ToastyModule, ToastyService, ToastyConfig} from 'ng2-toasty';
import { NavbarComponent } from './navbar/navbar.component';
import {LensService} from "./lens/lens.service";
import { LoadersCssModule } from 'angular2-loaders-css';
import { ModifiersComponent } from './modifiers/modifiers.component';
import {ReportService} from "./lens/reports.service";
@NgModule({
declarations: [
AppComponent,
MainComponent,
SourceComponent,
ReportComponent,
LensComponent,
HistoryComponent,
PageNotFoundComponent,
FileUploadComponent,
NavbarComponent,
ModifiersComponent,
],
imports: [
ToastyModule.forRoot(),
BrowserModule,
FormsModule,
HttpModule,
appRoutes,
LoadersCssModule,
],
providers: [ToastyConfig, ToastyService, SourceService, LensService, ReportService],
bootstrap: [AppComponent]
})
export class AppModule { }
Implementation:
import {Component, OnInit} from '@angular/core';
import {Observable} from "rxjs";
import {Headers, RequestOptions, Response} from "@angular/http";
import {ToastOptions, ToastData, ToastyService, ToastyConfig} from "ng2-toasty";
@Component({
selector: 'app-source',
templateUrl: './source.component.html',
styleUrls: ['./source.component.css']
})
export class SourceComponent implements OnInit {
public sources: Observable<DTOSourceFile[]>;
public toastOptions: ToastOptions;
constructor(public service: SourceService, private toastyService: ToastyService, private toastyConfig: ToastyConfig) {
}
ngOnInit() {
this.initToast();
this.sources = this.service.source;
this.service.loadAll();
}
initToast() {
this.toastyConfig.theme = 'material';
this.toastyConfig.position = "top-right";
this.toastOptions = {
title: "",
msg: "",
showClose: true,
timeout: 5000,
theme: "material",
onAdd: (toast: ToastData) => {
console.log('Toast ' + toast.id + ' has been added!');
},
onRemove: function (toast: ToastData) {
console.log('Toast ' + toast.id + ' has been removed!');
}
};
}
Can you reproduce that issue with the latest build (2.2.0)?
Please use 2.2.2 because 2.2.0 had the critical bug.
Look at ng2-webpack-demo built with the help of the latest Angular-CLI version 1.0.0-beta.24.
I'll check this out
Works Great!