Skip to content

Can't access variable inside another. #3441

Answered by SimoTod
rexwebmedia asked this question in 5. Bugs
Discussion options

You must be logged in to vote

You'll need something like

<section x-data="{
    countries: ['A', 'B', 'C'],
    get work_address() {
        return {
            name: 'John',
            available_places: this.countries,      
        }
   }
}">

as a separate note, the current scope in JS is always hard to grasp and source of bugs, I suppose this is an oversimplified example but it might be wise to find a different data structure

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rexwebmedia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants