Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesAdding SPA module to DNN 9 causes API errorAdding SPA module to DNN 9 causes API error
Previous
 
Next
New Post
3/11/2017 5:02 PM
 

I added a fairly basic module to DNN 9.00.02.  As soon as I drop the module on a page, the edit bar no longer works.

The View.html looks like this:

[ { jsname: "JQuery" 

[ { path: "~/Resources/Shared/scripts/dnn.jquery.js"}]

[ { path: "~/Resources/Shared/scripts/ng/angular.min.js"}]

[ { path: "~/Resources/Shared/scripts/ng/angular-cookies.min.js"}]

[ { path: "~/Resources/Shared/scripts/ng/angular-resource.min.js"}]

[ { path: "~/Resources/Shared/scripts/ng/ui-grid.min.js"}]

[ { path: "~/DesktopModules/DnnMain/Scripts/appMain.js"}]

[ModuleAction:{controlKey : "Edit", securityAccessLevel : "Edit",  titleKey: "EditModule", localResourceFile: "~/DesktopModules/DnnMain/App_LocalResources/View.resx" }]


<script type="text/javascript">

    angular.element(document).ready(function () {

        var moduleContainer = document.getElementById('mainContent-inner');

        angular.bootstrap(moduleContainer, ["appMain"]);

    });

</script>

The error displayed in the browser console is as follows:

GET http://localhost/DesktopModules/admin/Dnn.EditBar/undefinedDesktopModules/editBar/common/API/localization/gettable?culture=en-US 404 (Not Found)

GET http://localhost/DesktopModules/admin/Dnn.PersonaBar/undefinedAPI/personaBar/localization/gettable?culture=en-US 404 (Not Found)

It appears a script I'm including may be interfering and causing the "undefined" to be inserted in those calls, but I'm not strong enough in JS debugging to figure out where.  Any ideas?

 
New Post
3/12/2017 12:15 AM
 

I found the source of the error, but not exactly a fix.  There is a QuickSettings.js file inherited from Scott's module template for DNN 7/8/9.  When I removed the reference to this file, it cleared my errors.  Of course the settings menu isn't working now.  Most likely, the variables are overwriting other global variables.

 

var DnnSpaTest = DnnSpaTest || {};


DnnSpaTest.quickSettings = function(root, moduleId) {


    // Setup your settings service endpoint

    /*

    var service = {

        path: "DnnSpaTest",

        framework: $.ServicesFramework(moduleId)

    }

    service.baseUrl = service.framework.getServiceRoot(service.path) + "Settings/";

    */


    var SaveSettings = function () {

        Save Settings");

        var deferred = $.Deferred();

        return deferred.promise();

    };


    var CancelSettings = function () {

        var deferred = $.Deferred();

        deferred.resolve();

        return deferred.promise();

    };


    var LoadSettings = function () {


    };


    var init = function () {

        // Wire up the default save and cancel buttons

        $(root).dnnQuickSettings({

            moduleId: moduleId,

            onSave: SaveSettings,

            onCancel: CancelSettings

        });

        LoadSettings();

    }


    return {

        init: init

    }

};

 

 

 
New Post
3/20/2018 6:42 PM
 
I ran into this but haven't had time to figure out the why... I just needed to clear the error for a demo... but in case someone runs across this thread and wants quick fix, the culprit is this line:

service.baseUrl = service.framework.getServiceRoot(service.path) + "Settings/";

Wrap it in a timeout:

setTimeout(function() {
service.baseUrl = service.framework.getServiceRoot(service.path) + "Settings/";
}, 0);

This basically pushes it back in the execution stack. Clear your browser cache when you refresh.

Reflect Media Group

We specialize in building custom modules and web apps with Xmod Pro for the DNN platform.
ReflectMediaGroup.com
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesAdding SPA module to DNN 9 causes API errorAdding SPA module to DNN 9 causes API error


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  

What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out