Hi folks,
I am using Asp.net 5 with visual studio 2015 and I am using new angular
2.0. I am having problem with http get method.
Here is my sample program code:
*wwwroot->App->App.ts:*
> import {bootstrap, Component, CORE_DIRECTIVES} from 'angular2/angular2';
> import {Http, 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);
>
*wwwroot->App->friends.json:*
{
"friends": [ "Joe", "Tim", "Jim", "Jane" ]
}
*wwwroot->Page.html*<h1>My First Angular 2 App</h1>
List of friends loaded successfully
<div *ngFor="#friend of result.friends">
{{friend}}
</div>
I am getting error message and it says "EXCEPTION: Cannot resolve all
parameters for AppComponent(?). Make sure they all have valid type or
annotations. angular2.dev.js:25756"
Any idea?
I am waiting for your response. Thanks
--
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.