After this question, I have new a question. What is the difference between these two ways?
This was my initial code:
import {Http, HTTP_PROVIDERS} from 'angular2/http';
@Component({
viewProviders: [HTTP_PROVIDERS],
..//
constructor(http: Http){
..//
but while doing tests, They provided with codes to find the error:
import { Component, Inject} from 'angular2/core';
//above code should be at start.
constructor(@Inject(Http) http: Http) {
I think it works the same either way, someone could tell me, what is the difference, or just the first one is like the second but @Inject
is implicit or something similar.Sorry for my English.