【问题标题】:Vaadin-date-picker dynamically set a default date using Angular2Vaadin-date-picker 使用 Angular2 动态设置默认日期
【发布时间】:2016-08-10 10:39:37
【问题描述】:

我正在尝试使用 Angular2 在 vaadin-date-picker 中动态设置默认日期。在我的项目上实施这些任务时,它显示了一个异常。

我的代码和错误的 PFA

谢谢。

点击查看异常图片:Exception Image
点击获取代码 ImageCode Image

【问题讨论】:

    标签: angular typescript polymer vaadin-elements vaadin-date-picker


    【解决方案1】:

    答案在这里:https://vaadin.com/forum#!/thread/13790736

    谢谢

        pad(i: number) {
      return i < 10 ? '0' + i : i;
    }
    
    ngOnInit() {
      const selectedDate = new Date();
      this.birthday = `${selectedDate.getFullYear()}-${this.pad(selectedDate.getMonth() + 1)}-${this.pad(selectedDate.getDate())}`;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多