데이터베이스 값에 따라 여러 부분을 표시하는 단일 페이지가 있습니다. 순간에 나는 단지 표시/숨기기를 사용하여 div를 표시하지만 적절한 앵귤러 방식으로하고 싶습니다. 그래도 문제가 발생했습니다.각도/노드/비취가 부분 부분을 동적으로 표시합니다.
내 routes.js이 .......
exports.index = function(req, res){
res.render('index');
};
exports.partials = function (req, res) {
var name = req.params.name;
res.render('partials/' + name);
};
내 컨트롤러 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
function AppCtrl($scope, $http, $q, socket, $location) {
$scope.config = [[ return variables from 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;
입니다
는 말했다의 한 페이지에 여러 개의 부분이있을 것입니다. 데이터베이스의 설정 저장소에 따라 cluded 어떻게 할 수 있습니까?
코드를 NG-스위치를-때 사용하는 범위에서이 개 변수를 설정하여 그것을 해결했다 ; else $ scope.mainpAudio == false;'아기 예수님이 부르짖 게 만듭니다. 당신의 double-equals는 첫 번째 경우에는 triple-equals이어야하고 그 이후에는 single-equals이어야하며 전체는'$ scope.mainpAudio = ($ scope.config.name === 'audio')' – Malvolio