0

Hi i'm new to building web pages applications, i started with HotTowel videos from John Papa and used initially the HotTowel VSIX Template.

When i decided to update to Durandal 2.0 i faced the issue that the application would not proceed from the activate method in the shell module.

After some Google search's i found out that the problem has to due with durandal using jquery promises, i have tried the fix announced in http://durandaljs.com/documentation/Q/ but its not working, can someone provide me with some light on the issue.

PS: im new to js and web in general so i'm sorry if the question isn't clear enough

in my shell.js i have:

function activate() {
    app.title = config.appTitle;


     return datacontext.primeData()
        .then(boot)
        .fail(failedInitialization);
}




function boot() {        
    logger.log('CodeCamper Backend Loaded!', null, system.getModuleId(shell), true);
    router.map(config.routes).buildNavigationModel();
    return router.activate();
}

function addSession(item) {
    router.navigateTo(item.hash);
}


function failedInitialization(error) {
    var msg = 'App initialization failed: ' + error.message;
    logger.logError(msg, error, system.getModuleId(shell), true);
}

and in my datacontext:

var primeData = function () {

        var promise = Q.all([
            getLookups(),
            getSpeakerPartials(null, true)])
            .then(applyValidators)

        return promise 
            .then(success);



        function success() {
            datacontext.lookups = {
                rooms: getLocal('Rooms', 'name', true),
                tracks: getLocal('Tracks', 'name', true),
                timeslots: getLocal('TimeSlots', 'start', true),
                speakers: getLocal('Persons', orderBy.speaker, true)
            };
            log('Primed data', datacontext.lookups);
        }

        function applyValidators() {
            model.applySessionValidators(manager.metadataStore);
        }

    };
forcewill
  • 1,637
  • 2
  • 16
  • 31

1 Answers1

0

You need to pass a route into the router.activate() function to activate your first route. That is assuming two things -

  1. Your codecamper backend message is firing because your promise is being returned
  2. You have added the jQuery deferred to Q map shown in the page you referenced.

if the above two are not true then please let me know if you have indeed done number two and where your application is pausing or not loading

PW Kad
  • 14,953
  • 7
  • 49
  • 82
  • Hi in durandal 2.0 router we no longer pass a route to the activate function from what i understand in fact if if just return router.activate without the datacontext.primeData promise it works. – forcewill Aug 28 '13 at 12:18
  • Have you tried handling a fail situation in your query to see if it is failing? Chain a .fail() on there and alert if error – PW Kad Aug 28 '13 at 12:48