Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70443

Error TS2304: Cannot find name 'Let' ,'headers', 'options'

$
0
0

@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.5

Can anyone help me out, thank you.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70443

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>