简体   繁体   English

Ionic Framework从一页导航到另一页

[英]Ionic Framework Navigate from one page to another page

I am developing android application in ionic framework. 我正在离子框架中开发android应用程序。 can any one guide me how i can redirect from one page to another page. 有谁能指导我如何从一页重定向到另一页。

Here is My code 这是我的代码

index.html 的index.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controller.js"></script>

</head>
<body ng-app="starter">

    <ion-pane>

    <div class="item" align="center">
        Current Seminars
    </div>

    <ion-content  scroll="true" overflow-scroll="true" class="iframe-wrapper">
    <iframe class= 'webPage' data-tap-disabled="true" name= "eventsPage" src="http://www.google.com">
    </iframe>

</ion-content>

<div class="bar bar-footer bar-positive">
    <div class="title" align="center" >Next</div>

</div>
</ion-pane>

</body>
</html>

app.js app.js

// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
var app=angular.module('starter', ['ionic'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if(window.cordova && window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
  cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
});

When user click on "Next" then i want to redirect him/her on next page.Thanks in advance. 当用户单击“下一步”时,我想在下一页上重定向他/她。谢谢。

You can redirect one page to another page: 您可以将一个页面重定向到另一页面:

app/index.html 应用程序/ index.html的

<html ng-app="starter">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <link href="http://code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
    <script src="http://code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
 <script>
     angular.module('starter', ['ionic'])
     .config(function($stateProvider, $urlRouterProvider) {
         $stateProvider
         .state('home', {
              url: "/home",
              templateUrl: "templates/home.html",
              controller: "HomeCtrl"
        })
        .state('detail', {
              url: "/detail",
              templateUrl: "templates/detail.html",
              controller: "DetailCtrl"
         })    
       $urlRouterProvider.otherwise("/home");
     })
     .controller('HomeCtrl', function($scope) { 
     })
     .controller('DetailCtrl', function($scope) {  
     })
 </script>
 </head>
 <body>
    <ion-nav-bar></ion-nav-bar>
    <ion-nav-view></ion-nav-view>
 </body>
 </html>

app/templates/home.html 应用程序/模板/ home.html做为

<ion-view view-title="Home">
    <ion-content class="padding">
      <a ui-sref="detail">Next Page</a>          
    </ion-content>
</ion-view>

app/templates/detail.html 应用程序/模板/ detail.html

<ion-view view-title="Detail">
    <ion-content class="padding">
      <p>Detail</p>         
    </ion-content>
</ion-view>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在Android中从一页导航到另一页 - Unable to navigate from one page to another in android [ViewPager-如何使用按钮从一页导航到另一页? - [ViewPager - How to Navigate from one page to another using a button? 当我在 Android Studio 中将一个页面导航到另一个页面时,如何从 WebView 中删除导航? - How to remove Nav from WebView, when I Navigate one page to another page in Android Studio? 如何使用 React Native 将一个页面导航到另一个页面? - How to navigate one page to another page using React Native? 如何在android phonegap中将一个页面导航到另一个页面? - How to navigate one page to another page in android phonegap? 我想知道如何在按钮单击时从Java AWT中的一个XML页面导航到另一个XML页面 - i want to know how to navigate from one XML page to another in Java AWT on button click 如何使用Titanium Studio在iPhone和Android中将页面导航到另一页面 - how to navigate one page to another in iphone and android using titanium studio 如何在android中导航到另一个页面? - How to navigate to another page in android? NativeScript从自定义Android活动导航到另一个页面 - NativeScript navigate to another page from custom Android activity 从一页切换到另一页 - Switch from one page to another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM