1.javascript
console.log($scope.chats) var eventObject = ''; $scope.eventList = function(){ for( var i = 0 ; i< $scope.chats.length ;i++){ //eventObject+= '<button id="' + $scope.chats[i].id + '" style="width: 100vw" > <h1>' + $scope.chats[i].name + '</h1></button>'; if(i==0){ //$scope.test(); eventObject+= '<button id="' + $scope.chats[i].id + '" style="width: 96vw;text-align: left;height: 20vw;margin-left: 2vw" > <h2 style="height: 10vw;font-size: 5vw"> <img style="height:12vw;width: 12vw;" src="' + $scope.chats[i].face + '" >' + $scope.chats[i].name + '</h2> <h3 style="text-align: right;width: 100%;margin-top:-2vw ;height: 5vw;color: darkgray;font-size: 5vw">' + $scope.chats[i].lastTextTime + '</h3> </button>'; } else { eventObject+= '<div style="background-color: darkgray;width: 3px;height: 8vw;margin-left: 11vw"></div><button id="' + $scope.chats[i].id + '" style="width: 96vw;text-align: left;height: 20vw;margin-left: 2vw" > <h2 style="height: 10vw;font-size: 5vw"> <img style="height:12vw;width: 12vw;" src="' + $scope.chats[i].face + '" >' + $scope.chats[i].name + '</h2> <h3 style="text-align: right;width: 100%;margin-top:-2vw ;height: 5vw;color: darkgray;font-size: 5vw">' + $scope.chats[i].lastTextTime + '</h3> </button>'; } } $('#eventlist').html(eventObject); var event; //for( var j = 0 ; j< 3 ;j++){ // event=$scope.chats[j]; // console.log(event.id); // var eventDom=document.getElementById(event.id); // eventDom.onclick=function(){ // if (event.groupid == 20000) { // $state.go('tab.now-warning', { // msg: event.name // }) // } else if (event.typeid == 24009 || event.typeid == 24010 || event.typeid == 24011 || event.typeid == 24012 || // event.typeid == 14005 || event.typeid == 14006) { // //console.log("hr"); // $state.go('tab.now-event-trend-hrrr'); // } else if (event.typeid == 24007 || event.typeid == 24008 || event.typeid == 14004) { // //console.log("ans"); // $state.go('tab.now-event-trend-ans'); // } else { // //console.log(chat.chatType); // $rootScope.chartType = event.chatType; // $state.go('tab.now-event-trend'); // } // } //} /* $('#eventlist').find('button').each(function(){ $(this).click(function(){ alert(1); }) })*/ } $scope.eventList();