Issue #2893πŸ’¬ AnsweredOpened July 14, 2020by Hsin903210 reactions

Can I set for loop value in components render?

Quick answerby artf

Use the questionCom you're passing to the model (use model to update model related logic) and I'd suggest using API from the Components documentation (eg. textType.view.extend is the old one)

Read full answer below ↓

Question

Hi,I'm beginner in grapesjs. I want to make a question number by for loop when I dropped components, ↓I want final like this image. the div can show for loop number. ↓my component's code In render, I divided the my default html questionCom from {{i}} into front and back. then,put them in render. {{i}} can perfect to show 1 2 3 in component. but ,the divided method is not good. HTML can't easy to read and I can't set complex html if I want like↓ Have any better method can solve my question? Thanks!

Answers (1)

artfβ€’ July 29, 2020

Use the questionCom you're passing to the model (use model to update model related logic) and I'd suggest using API from the Components documentation (eg. textType.view.extend is the old one)

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.