1
除了使用ngDialog庫之外,我正在使用ng-repeat填充Firebase中的用戶對象。我的目標是,當你點擊一個'視圖'按鈕時,會彈出一個小對話框,您可以在其中查看用戶的詳細信息。但是,我試圖按照ngDialog的文檔,我的彈出式模板沒有渲染任何表達式。Angularjs表達式在ngDialog模板中沒有顯示
數據模型:
{
"members": {
"-JWT5y43YFy1mGirVVS2": {
"date": 1410328158691,
"firstname": "Michael",
"image": "http://telehealth.org/wp-content/images/user-placeholder.jpg",
"upcoming": "PTO on Thursday",
"status": {
"color": "red",
"contact": {
"email": "[email protected]",
"yahoo": "yahooIM"
},
"projects": {
"projectone": "project one",
"projecttwo": "project two",
"projectthree": "project three",
"projectfour": "project four",
"projectfive": "project five",
"projectsix": "project six",
"projectseven": "project seven",
"projecteight": "project eight",
"projectnine": "project nine",
"projectten": "project ten"
}
}
},
"-JWT65QvjwD4TSFjDx4V": {
"date": 1410328192928,
"firstname": "Magic",
"image": "http://telehealth.org/wp-content/images/user-placeholder.jpg",
"upcoming": "PTO on Thursday",
"status": {
"color": "yellow",
"contact": {
"email": "[email protected]",
"yahoo": "yahooIM"
},
"projects": {
"projectone": "project one",
"projecttwo": "project two",
"projectthree": "project three",
"projectfour": "project four",
"projectfive": "project five",
"projectsix": "project six",
"projectseven": "project seven",
"projecteight": "project eight",
"projectnine": "project nine",
"projectten": "project ten"
}
}
}
HTML:
<ul class="cbp-rfgrid" ng-repeat="member in members">
<li class="{{member.status.color}}">
<div class="dripicon profilephoto"></div>
<div>
<h3>{{member.firstname}}</h3>
<div class="dripicon actions"
ng-click="viewStatus()"></div>
<div class="dripicon actions"
ng-click="editStatus()"></div>
</div>
</li>
</ul>
控制器:
myApp.controller('MembersController', function($scope, $firebase, $location, ngDialog){
var ref = new Firebase('https://scrumcheck.firebaseio.com/members');
var members = $firebase(ref);
$scope.members = members.$asObject();
$scope.viewStatus = function(){
ngDialog.open({ template: 'views/popupTmpl.html' });
}
$scope.editStatus = function(){
//not entered yet
}
});
popupTmpl.html
<p>External modal template with external scope: <code>{{member.firstname}}</code></p>
當我點擊'view'按鈕時,觸發viewStatus()函數,我沒有得到{{member.firstname}}的任何東西 - 任何人都有基於你所看到的建議嗎?
再次感謝!