如何在离子应用程序中设置起始页

How to set a starting page in an ionic app?

本文关键字:设置 起始页 应用程序      更新时间:2023-10-03

当我在命令提示符下输入"ionic serve"时,我想将Registration.html页面设置为我的起始页面。

这是我的app.js代码,index.html&注册.html

为了达到这个结果,应该做出哪些改变?

app.js:

.config(function($stateProvider, $urlRouterProvider) {
 $stateProvider
    .state('Registration', {
        url: '/Registration',
        templateUrl: 'templates/Registration.html'
        controller: 'RegistrationController'
    })
 $urlRouterProvider.otherwise('/Registration');
})

index.html:

 <body ng-app="starter">
<ion-pane>
  <ion-header-bar class="bar-stable">
    <h1 class="title">Demo</h1>
  </ion-header-bar>
  <ion-content>
  </ion-content>
</ion-pane>

Registration.html:

<ion-view view-title="Registration">
<ion-content class="padding">
    <h1>Welcome !</h1>
    <h1>Please Sign in To Connect</h1>
    <div class="list">
        <button class="button ion-social-linkedin button-positive button-block" >Connect using LinkedIn</button>
        <button class="button ion-social-google button-positive button-block" >Connect using Google</button>
    </div>
</ion-content>
</ion-view>

在index.html中,在body标记之间只需放置<ion-nav-view></ion-nav-view>即可删除其他所有内容。。。

如果您使用状态应用程序,请尝试以下操作:

$urlRouterProvider.otherwise('/app/Registration');