原始例外:没有 Auth 提供者! : 离子云服务
ORIGINAL EXCEPTION: No provider for Auth! : Ionic Cloud Services
我设置了 Ionic Cloud Service 并完成了授权用户的初始过程。
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {Auth, User, UserDetails, IDetailedError} from '@ionic/cloud-angular';
@Component({
templateUrl: 'build/pages/signup/signup.html'
})
export class SignupPage {
constructor(public auth: Auth, public user: User){
let details: UserDetails = {'email': 'hi@ionic.io', 'password': 'puppies123'};
this.auth.signup(details).then(() => {
// `this.user` is now registered
}, (err: IDetailedError<string[]>) => {
for (let e of err.details) {
if (e === 'conflict_email') {
alert('Email already exists.');
} else {
// handle other errors
}
}
});
}
}
出于某种原因,我得到了这个 error:ORIGINAL 异常:没有 Auth 提供程序!
原始堆栈跟踪:
错误:DI 异常
一切都像离子云文档建议的那样设置为发球台:https://docs.ionic.io/services/auth/#setup
我到处找这个答案
试试这个
@Component({
templateUrl: 'build/pages/signup/signup.html',
providers: [Auth]
})
不确定它是否有效,因为 ionic 文档对此没有任何说明,但从您的错误来看似乎合乎逻辑
在 providers
中传递 Auth
,开始在控制台中显示该错误:
Cannot read property 'config' of undefined
在设置说明中,它讨论了如何将离子云 NgModule 添加到模块的导入中:
https://docs.ionic.io/setup.html
import { CloudSettings, CloudModule } from '@ionic/cloud-angular';
const cloudSettings: CloudSettings = {
'core': {
'app_id': 'APP_ID'
}
};
@NgModule({
declarations: [ ... ],
imports: [
IonicModule.forRoot(MyApp),
CloudModule.forRoot(cloudSettings)
],
bootstrap: [IonicApp],
entryComponents: [ ... ],
providers: [ ... ]
})
export class AppModule {}
我错过了这些步骤。进行此更改解决了问题。
我设置了 Ionic Cloud Service 并完成了授权用户的初始过程。
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {Auth, User, UserDetails, IDetailedError} from '@ionic/cloud-angular';
@Component({
templateUrl: 'build/pages/signup/signup.html'
})
export class SignupPage {
constructor(public auth: Auth, public user: User){
let details: UserDetails = {'email': 'hi@ionic.io', 'password': 'puppies123'};
this.auth.signup(details).then(() => {
// `this.user` is now registered
}, (err: IDetailedError<string[]>) => {
for (let e of err.details) {
if (e === 'conflict_email') {
alert('Email already exists.');
} else {
// handle other errors
}
}
});
}
}
出于某种原因,我得到了这个 error:ORIGINAL 异常:没有 Auth 提供程序! 原始堆栈跟踪: 错误:DI 异常
一切都像离子云文档建议的那样设置为发球台:https://docs.ionic.io/services/auth/#setup
我到处找这个答案
试试这个
@Component({
templateUrl: 'build/pages/signup/signup.html',
providers: [Auth]
})
不确定它是否有效,因为 ionic 文档对此没有任何说明,但从您的错误来看似乎合乎逻辑
在 providers
中传递 Auth
,开始在控制台中显示该错误:
Cannot read property 'config' of undefined
在设置说明中,它讨论了如何将离子云 NgModule 添加到模块的导入中:
https://docs.ionic.io/setup.html
import { CloudSettings, CloudModule } from '@ionic/cloud-angular';
const cloudSettings: CloudSettings = {
'core': {
'app_id': 'APP_ID'
}
};
@NgModule({
declarations: [ ... ],
imports: [
IonicModule.forRoot(MyApp),
CloudModule.forRoot(cloudSettings)
],
bootstrap: [IonicApp],
entryComponents: [ ... ],
providers: [ ... ]
})
export class AppModule {}
我错过了这些步骤。进行此更改解决了问题。