Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
Typscript: How do I Call Nested Array on Vue Data?

I created an interface with the code below:

export interface ISubcategories {
    subCategoryTopic: string;
    subCategoryImageURL: string;
    subCategoryImage: ISubcategoryImages[];
}

export interface ISubcategoryImages {
    podcastImageURL: string;
    videoImageURL: string;
    articleImageURL: string;
}

export interface ICategories {
    categoryTopic: string;
    subCategory: ISubcategories[];
}

I called it in the data section of my vuejs code with:

categoryData: {
  categoryTopic: "" as string,
  subCategory: [] as Array<ISubcategories>,
},

However, when I do add the code below to the textbox where I want the data to be, I get this error :

_vm.categoryData.subCategory.subCategoryImage is undefined.

What should I do ?

v-model="categoryData.subCategory.subCategoryImage.podcastImageURL"
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

One observation : As subCategory & subCategoryImage in interface ISubcategories is defined as an array. You can not access it's object directly with dot(.) notation. You can access elements via index or by iteration.

For ex :

<div v-for="(subCat, index) in categoryData.subCategory" :key="index">
    <div v-for"(imageUrl, i) in subCat.subCategoryImage" :key="i">
        <input v-model="imageUrl.podcastImageURL"/>
    </div>
</div>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!