Hi guys hope you all will be fine,
i making a simple ionic black app and modified its app.js to create states
app is working great with ionic serve command but when i install it on android phone with ionic run android it displays blank white screen.
chrome inspector show following erron
Failed to load resources (view.html file not found)
Failed to load resources (newView.html file not found)
view.html file like dashboard
here is my app.js file code
angular.module('starter', ['ionic'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.controller("AppController",function($example,$scope, $http){
console.log("hello");
})
.config(function($stateProvider,$urlRouterProvider, $ionicConfigProvider){
$ionicConfigProvider.navBar.alignTitle('center')
$stateProvider
.state('view', {
url: "/view",
abstract: false,
// controller: 'AppController',
templateUrl:"/templates/view.html"
})
.state('viewRecord', {
url: "/viewRecord",
// controller: 'AppController',
templateUrl:"/templates/viewRecord.html"
})
.state('edit', {
url: "/edit",
// controller: 'AppController',
templateUrl:"/templates/editRecord.html"
})
.state('delete', {
url: "/delete",
// controller: 'AppController',
templateUrl:"/templates/deleteRecord.html"
})
.state('new', {
url: "/new",
// controller: 'AppController',
templateUrl:"/templates/newRecord.html"
})
$urlRouterProvider.otherwise('/view');
});
here my view.html
<ion-header-bar class="bar bar-balanced">
<h1 class="title">Database Tester</h1>
</ion-header-bar>
<ion-content>
<div class="card">
<div class="item item-balanced">
Welcome to Database Tester.
</div>
<div class="item item-text-wrap">
Please Select an Option to test the database.
</div>
<div class="option">
<button class="button opt button-balanced" ui-sref="new" href="/new">New Record</button>
<button class="button opt button-balanced" ui-sref="edit" href="/edit">Edit Record</button>
<button class="button opt button-balanced" ui-sref="viewRecord" href="/viewRecord">View Record</button>
<button class="button opt button-balanced" ui-sref="delete" href="/delete">Delete Record</button>
</div>
<div class="item"></div>
<div class="item item-balanced">
</div>
</div>
</ion-content>
<div class="bar bar-footer bar-balanced">
<div class="title" ui-sref="view" href="/view"><i class="icon ion-home"></i></div>
</div>
here is my index.html
<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">
-->
<script src="js/jquery-1.11.2.js"></script>
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="js/app.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
<!-- your app's js -->
<ion-nav-view></ion-nav-view>
Perhaps, change
templateUrl:"/templates/newRecord.html"
to ("/templates..." -> "./templates....")
templateUrl:"./templates/newRecord.html"
Greetings @secret4info!
I've closed this issue because my sensors indicated it was old and inactive, and may have already been fixed in recent versions of Ionic. However, if you are still experiencing this issue, please feel free to reopen this issue by creating a new one, and include any examples and other necessary information, so that we can look into it further.
Thank you for allowing me to assist you.
I realize this went stale and is closed, but I had this exact issue, and tlkiong's answer was exactly correct. It seems like the native device needed the period in the templateUrl whereas running in web browser didn't. Both work for me now.
templateUrl:"./templates/newRecord.html"
Most helpful comment
Perhaps, change
to ("/templates..." -> "./templates....")