node.js - Angular / Nodejs / Jade dynamically display partials -
i have single page display multiple partials, depending on database values. @ moment using show/hide display div proper angular way, have been having trouble though.
my routes.js is
exports.index = function(req, res){ res.render('index'); }; exports.partials = function (req, res) { var name = req.params.name; res.render('partials/' + name); };
my controller
function appctrl($scope, $http, $q, socket, $location) { $scope.config = [[ return variables http call ]] if($scope.config.name =='video') $scope.mainpvideo ==true; else $scope.mainpvideo ==false; if($scope.config.name =='audio') $scope.mainpaudio ==true; else $scope.mainpaudio ==false; if($scope.config.embed =='qa') $scope.qa ==true; else $scope.qa ==false;
index.jade
#box-1-content.auth-form-body(ng-show="mainpaudio" ) include partials/audio ul.presenterlist li presenters: li(ng-repeat='presenter in presenters' ){{ presenter.name }} br.clr #box-1-content.auth-form-body(ng-show="mainpvideo" ) include partials/video ul.presenterlist li presenters: li(ng-repeat='presenter in presenters' ){{ presenter.name }} br.clr #box-2-content.auth-form-body(ng-show="qa" ) include partials/qa br.clr
.......
as said single page , there multiple partials included depending on config store in database, how can done?
i don't know jade, i'm guessing like
div(ng-include="'partials/' + config.name")
will want.
Comments
Post a Comment