2

I develop a Onsenui app on Monaca and I'd like to add a custom function on my on-right-button-click event :

<ons-navigator 
  title="MyTitlte"
  right-button-icon="fa fa-lg fa-refresh"
  on-right-button-click="refresh()"
  page="pages/msg.html">
</ons-navigator>

my refresh() function is defined in my controller

moduleApp.controller('MyCtrl', ['$scope', '$http', function ($scope, $http) { 

   // Refresh items
   $scope.refresh = function () {
    ....
   };
}]);

Thanks for your help

Andi Pavllo
  • 2,506
  • 4
  • 18
  • 30
charlesen
  • 65
  • 1
  • 7

1 Answers1

1

You need to set "MyController" on the navigator or above the navigator.

<ons-navigator
  ng-controller="MyController" 
  title="MyTitlte"
  right-button-icon="fa fa-lg fa-refresh"
  on-right-button-click="refresh()"
  page="pages/msg.html">
</ons-navigator>
Tamura
  • 1,788
  • 1
  • 14
  • 10