0

I'm trying to set variables depending on options using <lightning-combobox> but I'm getting a deploy failure. The code I m trying is the following

JS

get timing() {
        return [
            { label: 'Weekly', this.minute= '0', this.hour='0', this.DoM='*', },
            { label: 'Monthly', this.minute= '0', this.hour='0', this.DoM='1',this.month='*',this.DoW='*'},
            { label: 'Code' },
        ];
    }

and for HTML

<lightning-combobox placeholder="Time Set" options={timing}  onchange={handleTimeChange}></lightning-combobox>

Is there a method that i can use similaire to what i tried or am i obliged to set a value for the lightning-combobox and then create conditions depending on it

1 Answer 1

0

There are syntax errors in your code. The corrected version is this:

get timing() {
        return [
            { label: 'Weekly', minute: '0', hour: '0', DoM: '*' },
            { label: 'Monthly', minute: '0', hour: '0', DoM: '1', month: '*', DoW: '*'},
            { label: 'Code' },
        ];
    }

If you’re using VS Code you should have seen red squiggly lines under that block.

If you’re using eslint it will fail.

If you’re not using both VS Code and eslint, I strongly recommend you use both. They make it trivial to identify and correct syntax errors like this.

2
  • Yeah i had red lines, will the minute: '0' value be set to be used in another JS function? Commented Jul 18, 2019 at 19:28
  • The code above returns a new object. It does not change any instance property. Commented Jul 18, 2019 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .