在执行 prefillLoginId 时,我总是得到 false (默认值),即使订阅中的每个代码都在执行。请帮助我返回 True 值。
private prefillLoginId(currentLoginId: any, cms: any)
{
let status =false;
let patterns = [];
this.subSink.sink = cms.subscribe(content => {
patterns = !!content['ClientSideValidations']['LoginId'] ? content['ClientSideValidations']['LoginId'] : [''];
status = this.patternCheckStatus(patterns, currentLoginId);;
});
return status;
}
private patternCheckStatus(patterns:any,currentLoginId)
{
let patternCheckStatus = false;
let regex: RegExp;
patterns.forEach(x => {
regex = new RegExp(x);
if (regex.test(currentLoginId)) {
patternCheckStatus = true;
}
});
return patternCheckStatus;
}