javascript - AngularJS - Checkbox get the id from checked object -


as can see have list of objects in modal checkbox on right side. want click checkbox , check 1 single item. right when click on 1 checkbox, everthing gets checked. main thing want archieve following:

i want click on checkbox , id or team checked. thank help!

this modal:

<div class="col-md-12">     <ul class="list-group">         <li ng-repeat="team in teams" class="list-group-item">{{ team.alluserteamname + " - " + team.alluserteam }}              <label ng-repeat="(feature,enabled) in features">                  <input type="checkbox" ng-model="features[feature]"/>             </label>          </li>     </ul> </div>  <div class="modal-footer">     <div class="col-md-12">         <div class="row pad-team-selection-view">             <button class="btn btn-info"                  ng-click="creategameplanwithselectedmembers(team)">spielplan                                         erstellen             </button>         </div>     </div> </div>  {{features.value}} 

this controller:

app.controller('modalcreategameplancontroller', ['$scope', '$timeout', '$http', '$firebasearray', '$firebaseobject', function($scope, $timeout, $http, $firebaseobject, $firebasearray) {      $scope.selectusers = 'users';      $scope.$on('modal', function(event, args) {          var ref = firebase.database().ref("users");         var teams = $firebaseobject(ref);          $scope.features = {             value: false         };           teams.$loaded().then(function() {             $scope.teams = [];             angular.foreach(teams, function(key) {                 $scope.teams.push({                     alluserteamname: key.firstname,                     alluserteam: key.team                 });              });         });     }); }]); 

right when click on 1 checkbox, everthing gets checked.

the model needs different each team:

<div class="col-md-12">     <ul class="list-group">         <li ng-repeat="team in teams" class="list-group-item">             {{ team.alluserteamname + " - " + team.alluserteam }}              <label ng-repeat="(key,value) in features">                  <input type="checkbox"                         ng-model="team.key"                         ng-change="oncheckboxchange(team, key)"                  />             </label>          </li>     </ul> </div> 

how if checkbox true or false?

$scope.oncheckboxchange = function(team, key) {      console.log("change "+ team.alluserteamname);      console.log(key +" changed "+ team.key); }; 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -