I just updated my project from JS to TS, but it broke some parts, for example i had a component that imported a Config
injectable and used it through all the component, the same injectable is used through all the app in different pages and components, for some reason it only breaks when in this component, here’s my code:
import {Component, Output, EventEmitter} from 'angular2/core';
import {IONIC_DIRECTIVES} from 'ionic-framework/ionic';
import {Config, DB} from '../../services/services';
@Component({
selector: 'syncServ',
templateUrl: 'build/components/sync/sync.html',
directives: [IONIC_DIRECTIVES]
})
export class SyncComponent {
public orders: number = 0
public visits: number = 0
public tryIt : boolean = true
@Output() synced = new EventEmitter();
constructor(
public config: Config,
public db: DB
) {}
ngOnInit() {
this.updateSyncUi()
}
updateSyncUi() {...}
}
}
Here’s the console logs:
983455 error EXCEPTION: Cannot resolve all parameters for 'SyncComponent'(undefined, DB). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'SyncComponent' is decorated with Injectable.
983455 error STACKTRACE:
983455 error Error: Cannot resolve all parameters for 'SyncComponent'(undefined, DB). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'SyncComponent' is decorated with Injectable.
at NoAnnotationError.BaseException [as constructor] (http://localhost:8100/build/js/app.bundle.js:7773:24)
at new NoAnnotationError (http://localhost:8100/build/js/app.bundle.js:8647:17)
at _extractToken (http://localhost:8100/build/js/app.bundle.js:7747:16)
at http://localhost:8100/build/js/app.bundle.js:7699:46
at Array.map (native)
at Array.map (http://localhost:8100/build/js/app.bundle.js:67:17028)
at _dependenciesFor (http://localhost:8100/build/js/app.bundle.js:7699:20)
at resolveFactory (http://localhost:8100/build/js/app.bundle.js:7591:25)
at Object.resolveProvider (http://localhost:8100/build/js/app.bundle.js:7615:67)
at Function.DirectiveProvider.createFromType (http://localhost:8100/build/js/app.bundle.js:18461:30)