Angualr Scripts Missing in Preview Mode

Posted by Community Admin on 04-Aug-2018 21:46

Angualr Scripts Missing in Preview Mode

All Replies

Posted by Community Admin on 25-Oct-2017 00:00

We have a Sitefinity deployment that heavily uses Angular, and we noticed that in Preview mode on a page none of the Angular works and Angular scripts aren't even loaded. Is this by default or do we have a misconfiguration somewhere? If it's the latter, is there a generic place I would go to find that?

Posted by Community Admin on 27-Oct-2017 00:00

So I figured this out, for anyone else who may happen to have the same problem. Inside our MVC/Views/Layouts folder our template has a line of code that excludes the Angular scripts if SystemManager.IsDesignMode is true.

I tried putting a seperate call in for SystemManager.IsPreviewMode - but Sitefinity doesn't differentiate the two at the same level. So having something like this did not work:

if (SystemManager.IsDesignMode)
    //show specific code for design mode
else if (SystemManager.IsPreviewMode)
    //show specific code for preview mode

However, I was able to work around it by embedding an if/else for preview mode INSIDE the DesignMode it - so like this:

if (SystemManager.IsDesignMode)
    if (SystemManager.IsPreviewMode)
        //show specific code for preview mode
     else
        //show specific code for design mode
    

 

This thread is closed