모바일 애플리케이션에 angularJS + cordova를 사용하고 있습니다. 목록보기를 표시 할 수 있습니다. 해당 항목을 클릭하면 목록 항목을 업데이트하려고하는데 값이 변경되지만 UI가 업데이트되지 않습니다. 내 코드는 다음과 같습니다.AngualrJS 범위 변수가 업데이트 중이지만 UI가 아닙니다.
<md-list post class="" role="list" >
<md-item class="card" ng-repeat="post in posts">
<div class="card-header">
<div class="pro-pic">
<img src="{{post.UserImage}}" />
</div>
<h2>{{ post.UserName }}
<span>{{ post.CreatedDate | date:'medium' }} via --</span>
</h2>
<div class="post-info">{{ post.Description }}</div>
</div>
<div class="card-body">
<div class="card-img" ng-hide="post.IdeaImagePost == 0">
<img src="{{ post.IdeaImagePost }}" />
</div>
</div>
<div class="card-footer">
<div id="likeID" ng-click="onLike(post)"><i class="fa fa-thumbs-up {{post.LikeUserStatus ? 'active' : ''}}"></i><label> Like</label><span class="badge badge-xs badge-pink">{{ post.LikeUsersCount }}</span></div>
<div><i class="fa fa-commenting"></i> Comment<span class="badge badge-xs badge-pink">{{ post.CommentsCount }}</span></div>
</div>
</md-item>
</md-list>
더보기 여기
은 JS 코드를입니다
$scope.onLike = function(post) {
console.log("LikeUserStatus: " + post.LikeUserStatus);
post.LikeUserStatus = !post.LikeUserStatus;
post.LikeUsersCount = post.LikeUserStatus ? parseInt(post.LikeUsersCount)+1 : parseInt(post.LikeUsersCount)-1;
console.log("LikeUserStatus: " + post.LikeUserStatus);
};
값이 변경된 것을 볼 수 있습니까? – ni3aj
콘솔 로그를 인쇄 할 수 있습니다. – Avinash