【问题标题】:When I use 'esign&registration' it makes the 'registration' true. When I use the ''esignandregistration' it makes the 'eSignAndRegistration' true当我使用'esign&registration'时,它使'registration'为真。当我使用“esignandregistration”时,它会使“eSignAndRegistration”为真
【发布时间】:2021-07-12 18:42:06
【问题描述】:
  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' 为真。

【问题讨论】:

    标签: angularjs parameters ampersand queryparam


    【解决方案1】:

    我在 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;
    }
    

    【讨论】:

      猜你喜欢
      • 2016-01-09
      • 1970-01-01
      • 2021-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多