Question: I have a function onload which is just a simple console.log

```
<script>
onload = function(){
console.log('Hello');
}
</script>

```

I call it in my body like so

```
<body window.onload="onload();">

```

which after the page loads correctly prints

```
Hello

```

But I am trying to make it so when I click on my it also calls this function so I tried

```
<th onclick()="onload();">

```

Doing so results in 

```
Uncaught TypeError: onload is not a function

```

I thought I might add that I generate my html file using a jade template so the table is dynamically loaded in (not sure if that matters)

Thank you

Answer: 
try this one

```
import {Http, HTTP_PROVIDERS} from '@angular2/http';

    @Component({
          ....
           providers: [HTTP_PROVIDERS]
            ....})
    export class requester {
        constructor(private http:Http){}
        ...
    }

```

Assuming missing providers for your request
Assuming `requester` is a service.

Each `Component` which uses your service `requester` have to reference `HTTP_PROVIDERS`:

```
import {HTTP_PROVIDERS} from '@angular2/http';

@Component({
  ...
  providers: [HTTP_PROVIDERS, requester],
  ...
})

export class MyComponent{
  constructor(private _req: requester) {
  }
}

```