ionic-team / ionic2-starter-aws

Ionic + AWS MobileHub Starter Project
235 stars 47 forks source link

Can't resolve all parameters for User: (?, [object Object]). #34

Open VesperDev opened 7 years ago

VesperDev commented 7 years ago

i have a doubt ¿why when i try of get information of user i am get this error?

import { User } from '../../providers/providers';

user.getUser().getUserAttributes((err, data) => {
      console.log(data);
});

captura

mlynch commented 7 years ago

Hmm, not seeing this over here. Did you change any defaults or any code?

VesperDev commented 7 years ago

I revolved it as follows import { User } from '../../providers/user';

pablogravielseo commented 7 years ago

I have this problem, too, when creating a new page, and adding in tabs.

pablogravielseo commented 7 years ago

screenshot-localhost-8100-2017-09-02-15-21-35

swbradshaw commented 7 years ago

I had the same problem. @mlynch I believe this is problem with src/providers/user.ts

import { Cognito } from './providers'; should be changed to import { Cognito } from './aws.cognito';

The current import appears to be causing a circular reference and causing a problem. When I made the change above, that fixed the issue for me.

arupnayak commented 7 years ago

@swbradshaw thanks it worked

kevin-ripley commented 7 years ago

@swbradshaw I looked for about an hour on what the problem was trying to figure it out when I came here and your wizard powers cured it! Thanks, man!

pablogravielseo commented 6 years ago

Sorry for the late, @swbradshaw thanks it worked

MZabih commented 6 years ago

This error occur sometime when you define navcontroller like this(public navCtrl: NavController, public navParams: NavParams) in your .ts file's constructor, but dont import it on top of the page like thisimport { NavController, NavParams } from 'ionic-angular';

stiofand commented 6 years ago

I have had the same issue for three hours now, and despite the solutions this still has not worked.

# current-user-service.ts
@Injectable()
export class CurrentUserService {}

# authorization-service.ts
import { CurrentUserService } from './current-user-service';

@Injectable()
export class AuthorizationManager {
    constructor(private currentUserService: CurrentUserService) {}
}

# authorization-manager-service.ts
import { AuthorizationManager } from "./authorization-manager";

@Injectable()
export class AuthorizationManagerService {
    constructor(private authorizationManager: AuthorizationManager) {}
}

#app.module
import { AuthorizationManagerService } from "./authorization-manager-service";

...providers 
[ CurrentUserService, AuthorizationManager, AuthorizationManagerService ]....

Error:

Uncaught Error: Can't resolve all parameters for AuthorizationManager: (?).