1

while in edit mode checkbox is not getting checked!! in html i have this

<input type="checkbox" ng-model="overallfeedback" ng-change="collectFeedback(overallfeedbackElg, $index)" ng-checked="{{collectlistbla[$index]}}">

in ng-change i tried to push model vales in a array...

$scope.collectFeedback = function(oveallfeedbackElg, index){

    if($scope.collectlistbla.hasOwnProperty(index))
      $scope.collectlistbla.splice(index, 1, oveallfeedbackElg);
    else
      $scope.collectlistbla.push(oveallfeedbackElg);

    console.log($scope.collectlistbla);

  };

in edit page while getting responce .....

         console.log(response.overallfeedback);//true,true,true,true,true
        $scope.collectlistData = response.overallfeedback;
        $scope.collectlistbla= $scope.collectlistData.split(',');
        console.log($scope.collectlistbla);//["true", "true", "true", "true", "true"]

i must be doing some mistake.. do help... thanks in advance

2
  • change your ng-checked="{{collectlistbla[$index]}}" to ng-checked="collectlistbla[$index]" and try Commented Jun 9, 2016 at 9:47
  • awww im really soo thankfull to you....it worked... Commented Jun 9, 2016 at 9:56

1 Answer 1

1

Inside the ng- tags you don't need to use the {{}} to bind.

Try this:

<input type="checkbox" ng-model="overallfeedback" ng-change="collectFeedback(overallfeedbackElg, $index)" ng-checked="collectlistbla[$index]">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.