Thank you for your continuous support.
When I set OnsenUI to the latest v1.2.2, pushPage with the following code no longer works.
TypeError: Cannot read property 'pushPage' of undefined
The error appears (it worked in v1.2.1 by the way).
PushPage
The $scope.app.navi.pushPage("page.html");
It works, but I don't want to specify the name of the navigator like "app.navi" because I want to use the same child page for multiple navigators.
Please tell me how to deal with it.I look forward to your kind cooperation.
index.html (late head)
<script src="js/app.js"></script>
</head>
<bodying-controller="AppController">
<ons-navigator animation="slide" var="app.navi">
<ons-page>
<ons-button modifier="light" ng-click="openpage();"> Push</ons-button>
</ons-page>
</ons-navigator>
<ons-template id="page.html">
<ons-page>
<ons-button modifier="light" ng-click="app.navi.popPage('page.html');">Pop</ons-button>
</ons-page>
</ons-template>
</body>
</html>
app.js
var module=angular.module('app', ['onsen']);
module.controller('AppController', function($scope){
$scope.openpage=function(){
$scope.ons.navigator.pushPage("page.html");
};
});
Recent versions of Onsen UI no longer support the description ons.navigator
.Therefore, I think you can solve this problem by explicitly specifying the var
attribute of <ons-navigator>
and calling the pushPage()
method.
HTML side:
<ons-navigator var="myNavigator">
JavaScript side:
myNavigator.pushPage("page.html");
It is not a problem to use the same child page in multiple navigators.
Conversely, multiple navigators can define the same name.
925 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
579 Understanding How to Configure Google API Key
617 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.