I'm getting this error when trying to inject the Http service into my PanelsService.
import {Component} from 'angular2/core';
import {Http} from 'angular2/http';
export class PanelsService {
constructor(public http:Http) { }
getPanelFilters() {
var url = '../../data/panelFilters/' + 13677 + '.json'
return this.http.get(url)
}
}
I'm attempting to access the PanelsService from my SidebarComponent:
import {PanelsService} from '../panels/panels.service';
@Component({
....
providers: [PanelsService]
})
export class SidebarComponent implements OnInit {
constructor(public panelsService:PanelsService) { }
ngOnInit() {
console.log('I am the sidebar component');
}
}
It should be noted that my tsconfig.json also has the lines:
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
I've tried using @Injectable as demonstrated here but when I decorate my class with @Injectable() I get an error in the console:
boot.js simply bootstraps my app component, it doesn't inject any dependencies:
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './components/app.component';
bootstrap(AppComponent).catch(err => console.error(err));
Any help would be appreciated.
