如何解决Nebular - 如何在`getConfigValue()` 中注入自定义策略验证?
为什么 getConfigValue()
函数没有从自定义策略中获取验证值?
示例:
@Injectable()
export class CustomStrategy extends NbPasswordAuthStrategy {
protected defaultOptions: CustomStrategyOptions = CustomStrategyOptions;
static setup(options: CustomStrategyOptions): [NbAuthStrategyClass,CustomStrategyOptions] {
return [CustomStrategy,options];
}
}
export class CustomStrategyOptions extends NbPasswordAuthStrategyOptions {
validation?: CustomValidation;
}
export const customStrategyOptions: CustomStrategyOptions = new CustomStrategyOptions();
其中 CustomValidation
类包含与 fullName
、password
和 email
不同的字段,例如:name
、lastName
、{{1 }} 和 date birth
。
在表单输入中的自定义 gender
中,如果您尝试此操作:
RegisterComponent
输出为 export class RegisterComponent extends NbRegisterComponent implements OnInit {
ngOnInit() {
console.log('validations',this.getConfigValue('forms.validation');
}
}
、fullName
和 password
:(
如何在 Nebular 的 email
方法中注入自定义策略验证?
解决方法
这对我有用:
struct ContentView: View {
var body: some View {
#if os(iOS)
MainView()
#elseif os(macOS)
MainView()
.frame(width: 120)
#endif
}
}
struct MainView: View {
var body: some View {
HStack {
// a bunch of stuff in this stack
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。