lib/web.route.handler.js
function getInitialModel(routeInfo, page) {
    var initModelDeps = {
        appName:    routeInfo.appName,
        tokens:     routeInfo.tokens,
        routeInfo:  routeInfo,
        defaults:   page.defaults,
        activeUser: routeInfo.activeUser || {},
        currentScope: {}
    };

    // if no model, just return empty object
    if (!page.model) {
        return Q.when({});
    }
    // if function, inject and the returned value is the model
    else if (_.isFunction(page.model)) {
        return Q.when(injector.loadModule(page.model, null, { dependencies: initModelDeps }));
    }
    else {
        throw new Error(routeInfo.name + ' page invalid model() format: ' + page.model);
    }
}
function getInitialModel(routeInfo, page) {
    var initModelDeps = {
        appName:    routeInfo.appName,
        tokens:     routeInfo.tokens,
        routeInfo:  routeInfo,
        defaults:   page.defaults,
        activeUser: routeInfo.activeUser || {},
        currentScope: {}
    };

    // if no model, just return empty object
    if (!page.model) {
        return Q.when({});
    }
    // if function, inject and the returned value is the model
    else if (_.isFunction(page.model)) {
        return Q.when(injector.loadModule(page.model, null, { dependencies: initModelDeps }));
    }
    else {
        throw new Error(routeInfo.name + ' page invalid model() format: ' + page.model);
    }
}
function getInitialModel ( routeInfo , page ) { var initModelDeps = { appName : routeInfo . appName , tokens : routeInfo . tokens , routeInfo : routeInfo , defaults : page . defaults , activeUser : routeInfo . activeUser || { } , currentScope : { } } ; // if no model, just return empty object if ( ! page . model ) { return Q . when ( { } ) ; } // if function, inject and the returned value is the model else if ( _ . isFunction ( page . model ) ) { return Q . when ( injector . loadModule ( page . model , null , { dependencies : initModelDeps } ) ) ; } else { throw new Error ( routeInfo . name + ' page invalid model() format: ' + page . model ) ; } }
Get the initial model for a given page
@param routeInfo
@param page
Get the initial model for a given page