More in this section
Forums / Developing with Sitefinity / Angualr Scripts Missing in Preview Mode

Angualr Scripts Missing in Preview Mode

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 1 answered
  1. Jay
    Jay avatar
    0 posts
    Registered:
    06 Apr 2017
    25 Oct 2017
    Link to this post
    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?
  2. Jay
    Jay avatar
    0 posts
    Registered:
    06 Apr 2017
    27 Oct 2017
    Link to this post

    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
        }
    }

     

    Answered
2 posts, 1 answered