@lily28 wrote:
I am a beginner, I try to follow a tutorial and end up getting these errors:
Cannot find name ‘Let’
Cannot find name ‘headers’. Did you mean ‘Headers’?
Cannot find name ‘options’. Did you mean ‘Option’?Below is my code for access-providers.ts
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/timeout'; import { fileURLToPath } from 'url'; @Injectable() export class AccessProviders { //url backend api json server: string ='http://localhost/login-register-home/api'; constructor(public http: HttpClient){} postData(body, file){ Let headers = new HttpHeaders({ 'Content-Type' : 'application/json; charset=UTF-8' }); Let options = { headers: headers } return this.http.post(this.server + file,JSON.stringify(body), options) .timeout(59000)// 59 sec timeout .map(res => res); } }
Extra info:
Angular CLI & Angular: 9.0.7
Node: 12.16.1
rxjs : 6.5.4
typescript : 3.7.5Can anyone help me out, thank you.
Posts: 1
Participants: 1