当我使用“设计与注册”时,它使“注册”成为真实当我使用“esignandregistration”时,它使“esignandregistration”成为真

exdqitrt  于 2021-09-29  发布在  Java
关注(0)|答案(1)|浏览(272)
eSignAndRegistration: boolean;
  registration: boolean;
  esign: boolean;
  css: boolean;

  ngOnInit(): void {
    if (this.activatedRoute.snapshot.queryParamMap.has('registration')) {
      this.registration = true;
    } else if (this.activatedRoute.snapshot.queryParamMap.has('esign&registration')) {
      this.eSignAndRegistration = true;
    } else if (this.activatedRoute.snapshot.queryParamMap.has('esign')) {
      this.esign = true;
    } else if (this.activatedRoute.snapshot.queryParamMap.has('css')) {
      this.css = true;
    }
  }

为什么“&”符号会这样做?如何使用“esign&registration”使布尔值“esignandregistration”为真。

ebdffaop

ebdffaop1#

我在if语句中添加了多个条件,使其正常工作:

if (
  this.activatedRoute.snapshot.queryParamMap.has('esign') &&
  this.activatedRoute.snapshot.queryParamMap.has('registration')
) {
  this.eSignAndRegistration = true;
} else if (this.activatedRoute.snapshot.queryParamMap.has('registration')) {
  this.registration = true;
} else if (this.activatedRoute.snapshot.queryParamMap.has('esign')) {
  this.esign = true;
} else if (this.activatedRoute.snapshot.queryParamMap.has('css')) {
  this.css = true;
}

相关问题