I've been having this really annoying error. I'm working in Angular and configured the login service. Now all of a sudden it can't compile and displays a line of errors:
ERROR in src/app/login/login.component.ts(18,2): error TS1127: Invalid character. src/app/login/login.component.ts(18,3): error TS1127: Invalid character. src/app/login/login.component.ts(18,4): error TS1127: Invalid character. src/app/login/login.component.ts(18,5): error TS1127: Invalid character. src/app/login/login.component.ts(18,6): error TS1127: Invalid character. src/app/login/login.component.ts(18,7): error TS1127: Invalid character. src/app/login/login.component.ts(18,8): error TS1127: Invalid character. src/app/login/login.component.ts(18,9): error TS1127: Invalid character. src/app/login/login.component.ts(18,10): error TS1127: Invalid character. src/app/login/login.component.ts(18,11): error TS1127: Invalid character. src/app/login/login.component.ts(18,12): error TS1127: Invalid character. src/app/login/login.component.ts(18,13): error TS1127: Invalid character. src/app/login/login.component.ts(18,14): error TS1127: Invalid character.
line 18 is the last line of the following code, there are no characters on that line besides the '}'. I have absolutely no clue what I need to do next.
import { Component } from '@angular/core';
import {AuthService} from '../services/auth.service';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent {
constructor(public auth: AuthService) {
}
login() {
this.auth.login();
}
}
The service file it is linked to:
import { Injectable } from '@angular/core';
import {AngularFireAuth} from "angularfire2/auth";
import * as firebase from 'firebase';
import {Observable} from "rxjs/Observable";
@Injectable()
export class AuthService {
user$: Observable<firebase.User>;
constructor(private afAuth: AngularFireAuth) {
this.user$ = afAuth.authState;
}
login() {
this.afAuth.auth.signInWithRedirect(new firebase.auth.GoogleAuthProvider());
}
logout(){
this.afAuth.auth.signOut();
}
}