Some of my JSS components are throwing errors when trying to insert and edit them in the experience editor. Most of the errors come from the fact that the datasource hasn't been set yet. In MVC, I would use code like this:

@if (Model.DataSource == null && IsInEditingMode) {
     <div>Please add a datasource item.</div>
} else {
     <div>My Component....</div>

How do I do this in a JSS (Angular) component? Is there a better way to deal with this scenario?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.