활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
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.
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
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)
조회 수
답글
좋아요 수
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)
조회 수
답글
좋아요 수
hi,
@PostConstruct will be called after all injections , while i want to stop instantiation of sling model during drag and drop.
조회 수
답글
좋아요 수
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
조회 수
답글
좋아요 수
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.
조회 수
답글
좋아요 수