Question

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

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top