Thank you for replying.

Now I am getting different error message when HTTP_BINDINGS and it says 
"Failed to load resource: the server responded with a status of 404 (Not 
Found)................. http://localhost:40491/angular2/http";

On Monday, December 14, 2015 at 7:49:25 PM UTC+5, adil mourahi wrote:
>
> Hi,
> You need HTTP_BINDINGS to accomplish your http. 
>  
>
>> *wwwroot->App->App.ts:*
>>
>>> import {bootstrap, Component, CORE_DIRECTIVES} from 'angular2/angular2';
>>> import {Http,HTTP_BINDINGS, Response} from 'angular2/http';
>>>
>>> @Component({
>>>     selector: 'my-app',
>>>     templateUrl: './page.html',
>>>     directives: [CORE_DIRECTIVES]
>>> })
>>>
>>> export class AppComponent {
>>>
>>>     result: Object;
>>>     http: Http;
>>>     constructor(http: Http) {
>>>         this.result = { friends: [] };
>>>         http.get('friends.json')
>>>             .map((res:Response) => res.json())
>>>             .subscribe(res => this.result = res);
>>>     }
>>> }
>>> bootstrap(AppComponent,[HTTP_BINDINGS]);
>>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to