I need to pass some data from asp.net Webmethods to my Angular 2 class. I’m starting off with a very simple string “hello”. How can I use the server side Get()
method to populate the value
value ?
My .NET server side code:
[WebMethod]
public static string Get()
{
return "Hello Koby";
}
My Angular 2 code :
import {Component} from 'angular2/core';
import {Injectable} from 'angular2/core';
import {HTTP_PROVIDERS, Http, Response, Headers, RequestOptions} from 'angular2/http';
@Component({
selector: 'log',
templateUrl: '/Scripts/Angular2/templates/log.html'
})
export class Log {
private http;
value = ? // <----- This should come from the server
}
Thanks