문제

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

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top