Question: Angular 2 XSRFStrategy interfaces.js:16Uncaught SyntaxError: Unexpected token export

Question

Angular 2 XSRFStrategy interfaces.js:16Uncaught SyntaxError: Unexpected token export

Answers 0
Added at 2016-12-21 11:12
Tags
Question

I have tried to use CSRF, as mentioned in documentation as:

Your server may use a different cookie or header name for this purpose. An Angular application can customize cookie and header names by providing its own CookieXSRFStrategy values.

{provide: XSRFStrategy, useValue: new CookieXSRFStrategy('myCookieName','My-Header-Name') }"

I add this code to my providers in NgModule like that:

providers: [
    GlobalState,
    AuthGuard,
    AuthGuardManagerService,
    LoadingSpinner,
    AuthService,
    UserService,
    EmployeesService,
    Error401Handler,
    Error403Handler,
    Error422Handler,
    Error500Handler,
    {provide:RequestOptions, useClass: RestCredentialsRequestOptions },
    { provide: XSRFStrategy, useValue: new CookieXSRFStrategy('myCookieName', 'My-Header-Name') },
    CookieService,
    {
        provide: Http,
        useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, spinner:LoadingSpinner) => {
            return new HttpInterceptor(backend, defaultOptions,spinner);
        },
        deps: [XHRBackend, RequestOptions,LoadingSpinner]
    }
],

But I got an error as:

interfaces.js:16 Uncaught SyntaxError: Unexpected token export

what went wrong?

Answers
Source Show
◀ Wstecz