1

I am trying to make a database update if a checkbox is checked. Is there a way to do it with Ionic? I don't want to refresh the view or go to a different view. Looking to do similar to the facebook like on the web.

ion-checkbox ng-model="myvalue"

2
  • 1
    yes you can do it use $http.put method when checkbox is checked in your controller Commented May 31, 2016 at 7:05
  • Thanks Mohan. You should have answered it in the answer to get points. This works. Commented Jun 1, 2016 at 4:03

1 Answer 1

2

Yes. Basically you could to one of two thigs.

1) Create a ng-click on the checkbox that then calls a method on the controller which then calls a $http.put or whatever you like. you could pass the value to the method or just read it from the model.

2) By putting a watch on myValue like this:

 $scope.$watch('myValue', function() {
        alert('myValue has changed!');
    });
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.