Error on constructor

I have this service:

import {Injectable} from 'angular2/core'; 
import {Http, Headers} from 'angular2/http';
import 'rxjs/Rx';

@Injectable()

export class DataService() {

    constructor(private _http: Http) {}


}

This is throwing this error:

Error: Zone</Zone.prototype.run@http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1243:21
    zoneBoundFn@http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1220:21
    lib$es6$promise$$internal$$tryCatch@http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:468:17
    lib$es6$promise$$internal$$invokeCallback@http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:480:18
    lib$es6$promise$$internal$$publish@http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:451:12
    @http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:123:10
    Zone</Zone.prototype.run@http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1243:21
    zoneBoundFn@http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1220:21
    lib$es6$promise$asap$$flush@http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:262:10

    Evaluating http://localhost:3000/app/data.service.js
    Error loading http://localhost:3000/app/data.service.js as "./data.service" from http://localhost:3000/app/app.component.js
addToError()

Any ideas why?

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

You should remove brackets right after the class name:

@Injectable()
export class DataService { // <-----------

instead of

@Injectable()
export class DataService() { // <-----------