Ionic How To Add Blank Page As Home Page Of The App?
I would like to add new page into default ionic app with tabbed menu and display this page as the default page of the app. Here is how I tried to do that: I added new state into a
Solution 1:
I would say, that solution here should be surprisingly simple:
- Remove the view name
'home'
. In fact change it to''
(empty string)
There is a working plunker with this change?
.state('home', {
url: '/home',
views: {
// instead of this
// 'home': {
//use this
'': {
templateUrl: 'tpl.home.html',
controller: 'HomeCtrl',
}
}
})
Why? Because most likely the index.html would look like this:
<bodyng-app="myApp" >
...
<ion-nav-view></ion-nav-view></body>
And that means that the view name is "", almost like <ion-nav-view name=""></ion-nav-view>
Check that in action here
EXTEND based on the question extension
if we use ionic-like approach with separated file and module for controllers:
// inside of the index.html
<script src="js/controllers.js"></script>
// the controller.js
angular.module('starter.controllers', [])
We must be sure, that our app.js
does contain that module as well:
angular.module('myApp', [
'ionic',
'starter.controllers'// this is a MUST
])
Post a Comment for "Ionic How To Add Blank Page As Home Page Of The App?"