Skip to content

Instantly share code, notes, and snippets.

@wildermuthn
Last active August 29, 2015 14:02
Show Gist options
  • Save wildermuthn/19f4f129b39e8047c185 to your computer and use it in GitHub Desktop.
Save wildermuthn/19f4f129b39e8047c185 to your computer and use it in GitHub Desktop.
nodejs rendering of an object, injected straight into Angulart
// in app.js
app.get('/app/js/services/config.js', function(req, res) {
routes.getConfig(req, res, configs.angular);
});
// in routes/index.js
exports.getConfig = function(req, res, angular){
res.setHeader('Cache-Control', 'no-cache');
res.render('config', {
clientShortName: angular.clientShortName,
logoPath: angular.logoPath,
clientShortName: angular.clientShortName,
logoPath: angular.logoPath,
firebaseRootUrl: angular.firebaseRootUrl,
restUrl: angular.restUrl,
photoLarge: angular.photoLarge,
photoThumb: angular.photoThumb,
baseFileUrl: angular.baseFileUrl,
filepickerKey: angular.filepickerKey,
baseEmailAddress: angular.baseEmailAddress,
subdomain: angular.subdomain,
});
}
// in views/config.js
app.factory('Configs', function($q, $http, $location, $rootScope, $timeout) {
return {
clientShortName: '<%= clientShortName %>',
logoPath: '<%= logoPath %>',
firebaseRootUrl: '<%= firebaseRootUrl %>',
restUrl: '<%= restUrl %>',
photoLarge: '<%= photoLarge %>',
photoThumb: '<%= photoThumb %>',
baseFileUrl: '<%= baseFileUrl %>',
filepickerKey: '<%= filepickerKey %>',
baseEmailAddress: '<%= baseEmailAddress %>',
subdomain: '<%= subdomain %>',
isIphone: true,
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment