1

i am trying to bind the updated value of totalQuestions variable in the html. but it is showing below error. can anyone tell me where i did wrong.

enter image description here

HTML

<label><span class="red-text">Question No: </span><span>1 out of {{totalQuestions}}</span>/</label>

Variable:

date() {
        return {
            examKey: '',
            questionsIds: '',
            duration: 0,
            questionList: [],
            totalQuestions: ''
        }
    },

Methods

methods: {
    loadQuestionSet: function() {
            this.examKey = this.$route.params.key;
            this.$http.get(baseUrl.BASE_URL + 'question-set/key/' + this.examKey).then(
                (resp) => {
                    this.duration = resp.data.duration;
                    this.questionsIds = resp.data.questionIds;
                    this.loadQuestions();
                },
                (err) => {
                    this.$router.push("/exam");
                }
            );
        },

        loadQuestions: function() {
            this.$http.post(baseUrl.BASE_URL + 'question/exam/questions', this.questionsIds).then(
                (resp) => {
                    this.questionList = resp.data;
                    this.totalQuestions = this.questionList.length
                },
                (err) => {
                    console.log(err);
                }
            );
        }
},
beforeMount: function() {
        this.loadQuestionSet();
    }

1 Answer 1

4

You have a typo: date() should be data().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.