You can share controller's function with service. Try to register the function you want to attache to both page1Ctrl and page2Ctrl, then call the shared function from page2Ctrl. The following code is a example.
page1.html
<ons-page class="center" ng-controller="page1Ctrl">
<ons-navigator-toolbar
title="Welcome">
</ons-navigator-toolbar>
<h1>Page 1</h1>
<ons-button ng-click="goToPage2()">Push Page 2</ons-sbutton>
</ons-page>
page2.html
<ons-page class="center" ng-controller="page2Ctrl">
<ons-navigator-toolbar title="Page 2">
</ons-navigator-toolbar>
<h1>Page 2</h1>
<button class="topcoat-button" ng-click="popToPage1()">Pop Page1</button>
</ons-page>
app.js
var myApp = angular.module('myApp', ['onsen.directives']);
myApp.factory('pageService', function(){
return{
foo : function()
alert('foo');
}
}
});
myApp.controller('page1Ctrl', function($scope, pageService){
$scope.goToPage2 = function(){
pageService.foo();
$scope.ons.navigator.pushPage("page2.html");
}
});
myApp.controller('page2Ctrl', function($scope, pageService){
$scope.popToPage1 = function(){
pageService.foo();
$scope.ons.navigator.popPage();
}
});