Weird problem I don't know how to describe it in the title


In my app, I have a list to show all the messages loaded from the database.

<ion-item class="item-text-wrap" ng-repeat="msg in msgs">

Everything is fine until I add a button to modify the state of the message.

<ion-item class="item-text-wrap" ng-repeat="msg in msgs">
        {{msg.text}} {{msg.likes}}
        <button class="button button-clear button-positive icon ion-thumbsup" ng-click="like(msg)"></button>

The weird thing about the ‘like(msg)’ in the controller is that I cannot see the updated values of msg.likes.

$scope.msgs = Me.getMsgs('111');  // Me is a service to load msgs from database
$ = function(msg){
            msg.likes = msg.likes+1;

            /// just for test
            var msgs = Me.getMsgs('111');
                console.log(msg.text);   // print the original text instead of '111'!!!!
            console.log(msgs[0].likes); // print 0
            msgs[0].likes = 2;
            console.log(msgs[0].likes);// still 0
            msgs[0].my_add_a_new_property = 100;
            console.log(msgs[0].my_add_a_new_property); //OK, it is 100
            delete msgs[0].my_add_a_new_property);
            console.log(msgs[0].my_add_a_new_property); //OK, undefined
            delete msgs[0].likes;
            console.log(msgs[0].likes);// still 0         

I debuged the function step by step. I just get astonished that the modification does not take place, and I cannot figure out why.

I set a simplified example at

But there everything is OK.

Can anybody help me out or give me any hints?


I found the key before I killed myself.
I am not familar with sqlite, and I have no idea that the select results (objects) are not writable.
I selected the messages and tried to modify them…
That is it!