0

I have an array of urls which I need to send as the http service url path and generate the result based on the response type. the example array is as below.

this.urlArray = ["www.test.com","www.test2.com"];

I iterate over the array and generate div and will send the url to http service as parameter and based on the request type like "time-out", success and error will change the div color. Can anybody please tell how should I proceed.

3
  • What have you tried? Is the problem iterating over the array, or just basic $http usage in Angular2? Commented Oct 26, 2016 at 19:52
  • Problem is I need to send the url text to the http service as parameter. Commented Oct 26, 2016 at 19:54
  • Please check this plnkr.co/edit/rxtAgu3PqoNkV90vBSEX?p=preview Commented Oct 26, 2016 at 20:00

1 Answer 1

1

From https://angular.io/docs/ts/latest/guide/server-communication.html

  addHero (name: string): Observable<Hero> {
    let headers = new Headers({ 'Content-Type': 'application/json' });
    let options = new RequestOptions({ headers: headers });

    return this.http.post(this.heroesUrl, /*{ name }*/ this.urlArray, options)
                    .map(this.extractData)
                    .catch(this.handleError);
  }
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.