我是Angular的新人,现在我需要在4小时后使用谷歌找到我的问题的答案。
我的控制器
void Hey::draw()
{
glBegin(GL_LINES);
glColor4f(0, 1, 0,1);
glVertex2f( a.x, a.y );
glColor4f(0, 1, 0,1);
glVertex2f( b.x, b.y );
glEnd();
}
这是我的HTML
var user = AuthService.getUser();
$http.get("http://hannation.me/api/userplus/activities/", {
params: {
key: '57f211a0354d7',
comment: true,
cookie: user.cookie,
user_id: user.data.id
}
}).success(function(data) {
$scope.activities = data.activities;
$scope.activities.comments = [];
$scope.activities.comments = data.activities.comments;
$ionicLoading.hide();
$scope.$broadcast('scroll.refreshComplete');
});
这是我的JSON文件
<div class="list card activity-card" ng-repeat="activity in activities">
<div class="item item-avatar">
<img src="{{activity.user.avatar_thumb}}">
<div class="activity-header">
<h2>{{activity.user.username}}</h2>
<p>{{activity.time}}</p>
</div>
</div>
<div class="item item-body">
<div ng-bind-html='activity.content | limitHtml2 | limitHtml3' class="activity-content"> </div>
</div>
<div class="list card" ng-repeat="comment in activities.comments">
<div class="item item-avatar">
<img src="{{comment.avatar}}">
<div class="activity-header">
<p>{{comment.content}}</p>
</div>
</div>
</div>
<div class="item item-body activity-footer">
<a ui-sref="app.tabs.activity-single({id :activity.activity_id})" class="button button-full button-assertive">
<i>More</i>
</a>
</div>
</div>
我如何纠正$ scope到我的页面子元素用ng评论,用户就像一个?我尝试采用更多不同的方式而且不起作用。如何工作$ scope子元素?你们能告诉我一些例子,或者只是告诉我哪里有错误。我失去了更多的时间来寻找解决方案。
答案 0 :(得分:0)
成功回调,
$scope.user= data.user;
在html中
<img src="{{user.avatar_thumb}}">
<div class="activity-header">
<h2>{{user.username}}</h2>