Expected identifier or keyword at the end of the expression (in get API)


Expected identifier or keyword at the end of the expression (in get API)



PLease Somebody Help.



Got Struck in calling the get API.



Getting error as unexpected token..



What the mistake have I made..



Below is my Service Method:


get_tq() {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
// this.createAuthorizationHeader(headers);
return this.http.get(this.base_url + "learnchapter/get", { headers: headers })
.map((res: Response) => res.json().Results||);



}



And Components.ts Method:


this.service.get_tq().subscribe(data => {


let objResponse:tResponse =data;
if (objResponse.Code==200)
{
this.profile = data.Results;

console.log(this.profile);
this.profile.forEach((value, key) => {
this.profileInfo.push(value);
}); }

else if (objResponse.Code==403)
{

// $('#m1Modal').modal('hide');
this.toastr.error("Record already exists");

}

});



And Html code:


<ng-container *ngFor="let profiles_Result of profileInfo">

<tr >

<td>{{profiles_Result.}}</td>
<td>{{profiles_Result.chaptername}}</td>
<td>{{profiles_Result.parentflag}}</td>
<td>{{profiles_Result.teacherflag}}</td>

</tr>





Where are you getting the error - line number, code line anything?
– Karan Desai
Jul 2 at 5:47





Can you add a console log of objResponse inside the subscribe method. And update the question with the output?
– Anuradha Gunasekara
Jul 2 at 5:48


objResponse





Unexpected token , expected identifier or keyword at the end of the expression [{{profiles_Result.}}] in ng:///AppModule/LearnchapterComponent.html@264:22 ("
– mehul
Jul 2 at 5:48





So - you have not written variable name after dot in this line <td>{{profiles_Result.}}</td>
– Karan Desai
Jul 2 at 5:49


<td>{{profiles_Result.}}</td>





As your question is not clear. But I am guessing that you want to access the rest API which is protected and expecting the token which you are not passing or it is getting wrong token . And @Karan Desai has mentioned very correctly that you have missed the property value but you error is telling altogether another story.
– Prabhat Maurya
Jul 2 at 7:56









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to add background colour in existing image using Swift?

Moria Casán

How to make file upload 'Required' in Contact Form 7?