Angular material slider value is true but i want to transform it to 1

My problem is that I’ve got a slider in my component html file. This component got the value from the postgresql database. If in the database the data column is 1 the slider is true if it’s 0 the slider is false. ( True = active, False = inactive ) In my service and component i would like to update these sliders value. So if i click to the slider change the value and put it into the database. In my component i try to give this value 1 and value 0 if it’s true or false. The debugger isn’t show any kind of error, and i see that it post the Object to the backend but didn’t write it into the database. The object that i post is {username: username1, source_id: 4, **data: 1**}, but what i got back is wrong because it seems like that.

{username: username1, source_id: 4, **data: true**} 
{username:username2, source_id: 3, **data: 0**}

So what i want is that if the slider is true the component give that value 1 and put it into the database, if the slider value is false give it 0 value and put it into the database.


[checked]=" == 'true' ? true : false"
(change)=updateUserActivation(user) >


updateUserActivation(user) {
    var slidervalue =
    if ( == true ) slidervalue = 1
    else { slidervalue = 0 };
   var newUserActivationStatus = {
     data: slidervalue,
     username: user.username,
     country: user.source_id
   console.log(`Updating USER Status : ${user.username}`);
   const result = this.usercontrolService.updateUserActivation(newUserActivationStatus)
   result.subscribe(newUserStatus => {
     console.log(this.users, newUserActivationStatus);


updateUserActivation(data) {
            var headers = new Headers();
            headers.append('Content-Type', 'application/json');
            return this.http.put(BASE_URL + 'user/' + data.username, data, { headers: headers })
                  .map(res => res.json());           


function updateUserActivationStatus(req, res, next) {
    db.none('UPDATE accounts SET data=$1 WHERE username=$2 AND source_id=$3',
    [, req.body.username, req.body.source_id, parseInt(req.body.launched), parseInt(req.params.source_id)] )
      .then(function (user) {
            status: 'success',
            user: user,
            message: 'Updated UserStatus'

      .catch(function (err) {
        return next(err);

Source: New feed
Source Url Angular material slider value is true but i want to transform it to 1