first
exports.render = function(req,res){
res.render('index', {
title: 'welcome',
username : req.user ? req.user :''
});
};
I want to export object req.user to use
h2 Hello #{username.username}
h2 Hello #{username}
In Jade I can use it
div(ng-app='IndexController')
{{ #{username} | getUserData }}
but if i want to get it to angular it can't use
mainAppModule.filter('getUserData', function () {
return function (name) {
if (name)
console.log(name.username + "xxxxxxxxxxxxxxxxxxxxxxxxqqqqqqqqqq");
return 'Hellox, ';
};
});
How can i do it? how to get req.user for use in future.if there is other way to get object to use in angular please tell me.
Thank so much.
{{ #{username} }}is going to output{{someName}}, which in turn means angular will be looking for a property$scope.someName; it is not creating a property with the name as a value that could be consumed....ng-init. note that this is one of the only recommended uses for theng-initdirective.