Variable in ion-view title

i want to include a simple counter in the ion-view title.
Counter will be incremented by selecting options in the ion-view.
thanks!

Use $rootScope -
html:

<ion-view view-title="{{$root.counterValue}}">

JS:

 angular.module('myApp').controller('myAppCtrl',function($scope,$rootScope){
    //somewhere where you'll increment counter's value
   $rootScope.counterValue = $rootScope.counterValue ? $rootScope.counterValue ++ : 1;
 });

html:

<ion-view view-title="Counter({{counter}})">

already had a controller setup so just added to it :
.controller(‘FriendsCtrl’, function($scope, Friends) {
$scope.friends = Friends.all();
$scope.counter=0;
})

Thanks!

How do i increment this counter from inside a select though?

Add ng-change="incrementCounter()" to the select and then increment it in that function.

$scope.incrementCounter = function() {
    $scope.counter++;
}

hi i have a similar question. i have a variable containing an email adress. and i need to display it . my variable has the id seConnecter-input4. here is my code

<ion-view title="Profil" hide-back-button="true" id="page10">
  <ion-content padding="true" class="has-header">
    <ion-list id="profil-list4">
      <ion-item class="item-avatar" id="profil-list-item8">
       //display email 
        <p style="white-space:normal;">{localisation}</p>
      </ion-item>
    </ion-list>
    <a ui-sref="tabsController.seConnecter" id="profil-button20" class="button button-stable  button-block">Se déconnecter</a>
  </ion-content>
</ion-view>