Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Hi,
As per my observation on AEM 6.3, when we drag and drop our components, the sling model associated with component instantiates immediately.
my Sling Model is like this :- @Model(adaptables = SlingHttpServletRequest.class) with injectors like below
@Inject @Via("resource")
@Optional
private String message;
Is this observation is correct ? if yes, is there any way to stop this instantiation and just show the placeholder and upon authoring in dialog, create the instance of the model ?
Thanks in advance.
¡Resuelto! Ir a solución.
Vistas
Respuestas
Total de me gusta
AFAIK, it's the correct observation.
You would probably have to add check in your @PostConstruct method Apache Sling :: Sling Models or HTL (formerly known as Sightly)
Vistas
Respuestas
Total de me gusta
AFAIK, it's the correct observation.
You would probably have to add check in your @PostConstruct method Apache Sling :: Sling Models or HTL (formerly known as Sightly)
Vistas
Respuestas
Total de me gusta
hi,
@PostConstruct will be called after all injections , while i want to stop instantiation of sling model during drag and drop.
Vistas
Respuestas
Total de me gusta
I don't think so you can do it.
Best case, you can try to add a check on the sightly element where you add this class.
Thanks
Vistas
Respuestas
Total de me gusta
If you wrap your data-sly-use inside a data-sly-test that evaluates to false it will not be evaluated.
for example, let's say you have a simple text component with one simple authored property "simpleText"
You want to NOT instantiate the model if "simpleText" is NOT authored
you can do the following
```
<!-- NOTE the use of data-sly-test on the same element as the data-sly-use -->
<sly data-sly-test="${properties.simpleText}" data-sly-use.TextModel="package.path.to.model.Text"/>
<div>
<h1>placeholder</h1>
<h1>text is: ${properties.simpleText}</h1>
</div>
```
The model will only instanciate if simpleText is authored and will not otherwise.
you can always make a simple component and test.
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas