A problem about ng-model

I’ve got a strange problem about ng-model. There’re 2 buttons, which i put in ion-header-bar and in ion-content respectively, calling the same function to get a ng-model value. However, the results are different.one is what i want and the other one is undefined.
Codepen here: http://codepen.io/mjhlybmwq/pen/HKatx