在AngularJS中显示带有$ routeparams的详细信息页面

时间:2016-10-24 12:24:05

标签: angularjs

我对anugular很新,并且在另一页上显示对象的细节时遇到问题。

我的app.js文件:

when('/meetings/:id', {
  controller: 'detailController',
  templateUrl: 'views/detail.html'
}).

html页面:

<a href="#/meeting{{$index}}"><div class="item col-md-4" ng-repeat="(key, meeting) in meetings">

detailController.js:

myApp.controller('detailController', ['$scope', '$rootScope', '$firebase', '$routeParams', '$firebaseSimpleLogin', '$location', 'FIREBASE_URL', function(  $scope, $rootScope, $firebase, $routeParams, $firebaseSimpleLogin, $location, FIREBASE_URL) {$scope.whichmeeting = $routeParams.mId; $scope.whichuser = $routeParams.uId;
    var ref = new Firebase(FIREBASE_URL + '/users/' + $scope.whichuser + '/meetings/'); var meetingsList = $firebase(ref).$asArray();
    $scope.details = meetingsList[$routeParams.id];
    }]);

detail.html:

<div class="photo"> <div class="container"><span class="text">{{details.name}}</span><span class="text">{{details.bio}}</span>

    </div>
    </div>

不知道我做错了什么。请帮忙!谢谢!!!

0 个答案:

没有答案