Hi
I have below code and i want to convert it using @for condition. education is an array
Code
{{val}}Thanks
Hi
I have below code and i want to convert it using @for condition. education is an array
{{val}}Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 3, 2024, 1:11 AM EDT
Try this code:
Jobin SRank #886 · 2.4K reputationPosted Jun 3, 2024, 1:20 AM EDT
Hi Ramco,
@for(let val of education){
}
Try this
Vishal JoshiRank #377 · 6.7K reputationPosted Jun 3, 2024, 1:29 AM EDT
Hello Ramco,
Please try the below sample code to use @for Loop in your code.
Thanks
Vishal Joshi
Ramco RamcoRank #462 · 5.4K reputationPosted Jun 3, 2024, 1:32 AM EDT
Hi
I am getting error 'Cannot parse expression' on line (let val of education)
@for(let val of education){
}
Thanks
Ramco RamcoRank #462 · 5.4K reputationPosted Jun 3, 2024, 1:34 AM EDT
Hi Vishal
Can't it be done with @for instead of ngfor
Thanks
Mrunali SawantRank #763 · 3K reputationPosted Jun 3, 2024, 1:40 AM EDT
In Angular, you don't use the
@fordirective (which is specific to Razor syntax in ASP.NET). Instead, Angular uses the*ngFordirective to iterate over arrays in templates. Since you're already using*ngFor, it looks like there is a minor typo in your code (educaionshould beeducation). Here's the corrected code:If
educationis an array in your component, this will iterate over it and create afor each element.Ramco RamcoRank #462 · 5.4K reputationPosted Jun 3, 2024, 2:08 AM EDT
Hi All
Like below can't we use it in select statement
@for (item of employeeArray;track $index){
Thanks
Jobin SRank #886 · 2.4K reputationPosted Jun 3, 2024, 9:53 AM EDT
Hi Ramco,
check this and your code alse
Education @for (edu of educations;) { {{edu.name}} }ts File:
educations:any= [ {id: 1, name: 'B.E'}, {id: 2, name: 'B.Tech'}, {id:3, name: 'M.Sc'}, ];
Ramco RamcoRank #462 · 5.4K reputationPosted Jun 4, 2024, 1:12 AM EDT
Hi Jobin
It is giving error - @for loop lust have a track expression.
Thanks