oops I just missed this post Problem with ion-content and scope vars inside function which explains the reason.