Jan Gutnik Jan Gutnik - 2 months ago 17x
TypeScript Question

Getting Dynamic Forms in Angular 2 to get Questions from remote source

Ok, so actually what I want to do is just get the https://angular.io/docs/ts/latest/cookbook/dynamic-form.html to do what the first TODO in the question.service.ts says.

So really, how do I achieve this: // Todo: get from a remote source of question metadata.

I've been at this for a while and being a beginner at this I have no idea how to go about this. I've tried everything I could think of and still nothing. Please, I would be extremely happy for even the slightest idea.

Thanks in advance.


What you are looking for is creating a REST API on your server side which will give you data, and consume it in Angular Application using HttpModule

   // questionUrl -> 'api/auestions'

   getQuestions(): Promise<any[]> {
     return this.http.get(this.questionUrl)
           .then(response => response.json().data)

You may read more about it here

Hope this helps!!