V
V
valitskiydmitriy2017-05-30 11:05:25
Angular
valitskiydmitriy, 2017-05-30 11:05:25

How to make such a Get request in Angular 2?

There is a request like this:

public GetJobsListExcel(jobs: JobViewModel[] ): Promise<string> {
        let JobIds: number[] = [];
        jobs.forEach(x => JobIds.push(x.JobId));
        let url = `/api/job/jobs-list-excel?jobIds=${JobIds}`;
        return this.http.get(url)
            .toPromise()
            .then(response =>
                response.text() as string
            );
    }

It generates a link like: /api/job/jobs-list-excel?jobIds=$1,2,3 etc
And you need something like this: /api/job/jobs-list-excel?jobIds=$1?jobIds=$2 ?jobIds=$3
Tried everything, doesn't work, in which direction to dig? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2017-05-30
@valitskiydmitriy

1. dumb way:
2. look for an analogue of the $resource/restangular service for Angular2 with the ability to generate urls with placeholders.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question