1

I am new to Angular 8 and working on a project with a team. There is some code which I can't understand.It is very helpful to me if anyone will explain it.I shall be very thankful to that person who explains this code to me. In this code, are we using Jquery with angular?

fetch(state : State)
  {
    const queryStr = `?skip=${state.skip}&take=${state.take}&count=true&pageSize=${this.pageSize}&page=${state.skip/this.pageSize + 1}`;
    return this.http
        .get(`${this.url}?${queryStr}`)
        .pipe(
            map(response => (<GridDataResult>{
                data: response['Data'],
                total: parseInt(response['Total'])
            }))
            ,
            tap(() => false)
        );
  }

  public GetList(state: DataSourceRequestState): Observable<DataResult> {
    const queryStr = `${toDataSourceRequestString(state)}`; // Serialize the state
    const hasGroups = state.group && state.group.length;

    return this.http
        .get(`${this.url}?${queryStr}`) // Send the state to the server
        .map(response => (<GridDataResult>{
          data: response['Data'],
          total: parseInt(response['Total'])
      }))
        // .map(({data, total/*, aggregateResults*/} : GridDataResult) => // Process the response
        //     (<GridDataResult>{
        //         // If there are groups, convert them to a compatible format
        //         test : console.log(total ),

        //         data: hasGroups ? translateDataSourceResultGroups(data) : data,
        //         total: total,
        //         // Convert the aggregates if such exist
        //         //aggregateResult: translateAggregateResults(aggregateResults)
        //     })
        // )
}
1
  • 1
    All of the dollar symbols are being used for string interpolation, nothing to do with jQuery. Commented May 6, 2020 at 10:46

1 Answer 1

1

No Jquery here, syntax ${this.url}?${queryStr} is interpolation.

I example

url = 'home/index';

queryStr = 'id=1';

With interpolation ${this.url}?${queryStr} => 'home/index?id=1'

If you use concat string way, you can url + "?" + queryStr

You can refer more at Template literals

Sign up to request clarification or add additional context in comments.

1 Comment

syntax ${this.url}?${queryStr} is interpolation. Please give me some explanation links of this type syntax

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.