I have created a provider for authentication in ionic2 and Angualr2 for login, which is as follows:
login provider
@Injectable()
export class Service{
public token : any;
constructor(public http: Http, public storage: Storage){}
login(credentials){
return new Promise((resolve, reject)=>{
//headers implemented.
this.http.post('url', {headers: headers}, credentials)
.subscribe(res=>{
data = res.json();
this.token = data.token // error is shown here. red line on token.
storage.set('token',data.token)
resolve(credentials);});
Error which is reflected on the token is mentioned in the comment line on the word token
of data.token
.
Need Help.
via Aditya Jain
No comments:
Post a Comment