Web にログイン ユーザーのデータを保存するオブジェクトが必要です。ユーザーが接続された回数、ユーザーがページ間でページングした回数、ユーザーがテーブルを注文した回数、ユーザーが自分の名前をクリックした回数を数えてもらいたい.
私はこのオブジェクトを構築します:
$scope.User = {
'username': '',
'Password': '',
'connected': false,
'countConnect': 0,
'countPaging':0,
'countOrder':0,
'countTapName':0
};
これは counts の関数の例です:
$scope.tapName = function(){
if ($scope.username == $scope.User.username){
$scope.User.countTapName ++;
}
};
$scope.countOrder = function (){
$scope.User.countOrder++;
};
$scope.pageChanged = function() {
console.log('Page changed to: ' + $scope.currentPage);
$scope.User.countPaging ++;
};
私の問題は、個々のユーザーではなく、すべてのユーザーが同じカウントを取得することです。
html:
<td ng-click="tapName()" ng-model="un" class="col-lg-1">{{user.userN}}</td>
<td class="col-lg-1">{{user.PassW}}</td>
<td class="col-lg-1">{{user.Name}}</td>
<td class="col-lg-1">{{user.LastName}}</td>
<td class="col-lg-1">{{User.countConnect}}</td>
<td class="col-lg-1">{{User.countPaging}}</td>
<td class="col-lg-1">{{User.countOrder}}</td>
<td class="col-lg-1">{{User.countTapName}}</td>
それをより良くする方法はありますか?