我试图在firebase查询中显示HTML中的一条记录,我做错了什么?这是控制器:
function getUrlVars()
{
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,
function (m, key, value) { vars[key] = value; });
return vars;
}
var first = getUrlVars()["id"];
console.log("The id is: " + first);
$scope.username = CommonProp.getUser();
if (!$scope.username) {
$location.path('/home');
}
var firebaseObj = new Firebase("https://crackling-inferno-2072.firebaseio.com/Articles/" + first);
var sync = $firebase(firebaseObj.startAt($scope.username).endAt($scope.username));
$scope.title = sync.$asArray();
$scope.post = sync.$asArray();
console.log($scope.title);
console.log($scope.post);
console.log(sync);
console.log(firebaseObj);
我从网址http://localhost:8000/app/#/show?id=-KHNW-LTLsOejTd-cjcO抓取了ID 这是HTML
<div ng-repeat="article in articles">
<h1>{{title}}</h1>
<p>{{post}}</p>
</div>
<h1 ng-model="article.title">{{article.title}}</h1>
<p>{{post}}</p>
问题是没有任何内容正在运行,我需要显示该ID的标题和帖子。有人可以帮助我吗?
提前致谢