Angular - Check if all options are selected to enable button

前端 未结 3 414
礼貌的吻别
礼貌的吻别 2020-12-22 05:32

This is a quiz app, in this scenario my next button will redirect to another page and it\'s disabled by default. If I choose all the options it shou

3条回答
  •  鱼传尺愫
    2020-12-22 06:19

    you can use Object.keys for that, like this

    App.component.html

    
    

    app.component.ts

    isDisabled(): boolean {
      return Object.keys(this.answerEvaluation).length !== Object.keys(this.practiceQuizData).length;
    }
    

提交回复
热议问题