Hello Stackoverflowers, Apologies if this is duplicate, I really tried to find a simple answer for this, but I couldn't.
I need to pass some data from ASP.NET Webmethod 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 (Very simplified):
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
}
Being new to Angular 2, I can accept solutions, workarounds or curse words.
Thanks.