Ionic Add Start Page – Start page is added using the service $urlRouterProvider which is imported before using it. Here in this tutorial we are going to explain how you can add default page i.e. start page.
Ionic Add Start Page
You can add start page as below-
Javascript Part :
Ionic Add Start Page:` Home Page
.config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('tabs', { url: "/tab", abstract: true, templateUrl: "templates/tabs.html" }) .state('tabs.home', { url: "/home", views: { 'home-tab': { templateUrl: "templates/home.html", controller: 'MainCtrl' } } }) .state('profile', { url: "/profile", templateUrl: "templates/profile.html" }) .state('contact', { url: "/contact", templateUrl: "templates/contact.html" }); $urlRouterProvider.otherwise("/tab/home"); }) |
In the above example $urlRouterProvider.otherwise(“/tab/home”); is used to define the default home page ie. tab/home. If you run the above example it will open the default template home.
Html Part –
The template for the above example are –
Ionic Add Start Page Example: Home Pgae
<ion-nav-bar class="bar-positive"> <ion-nav-back-button> </ion-nav-back-button> </ion-nav-bar> <ion-nav-view></ion-nav-view> |