Export service from another module in Angular 2
I think you are getting error because you forgot @
before Injectable
:
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { AttendanceSummary } from './attendance-summary.model';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { HttpClientService } from '../core/httpClient.service';
@Injectable()
export class AttendanceSummaryService {
private apiBaseUrl = '/api/v1/agency/attendances/';
constructor(private http: HttpClientService) { }
}
For others finding this question. In your module, you may have your service listed in exports. It should be in your providers; not in imports, declarations, or exports.
@NgModule({
imports: [],
exports: [],
declarations: [],
providers: [export-service-here]
})