I’ve been searching the net all day for a solution but I can’t find one.
My routes are not working although there are no any errors in the console.
Here’s my 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 rel="manifest" href="manifest.json">
<!-- un-comment this code to enable service worker
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js')
.then(() => console.log('service worker installed'))
.catch(err => console.log('Error', err));
}
</script>-->
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
</head>
<body ng-app="myApp">
<ion-nav-view animation="slide-left-right"></ion-nav-view>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<script src="js/app.js"></script>
<script src="js/routes.js"></script>
<!-- controllers -->
<script src="js/controllers/loginCtrl.js"></script>
<script src="js/controllers/dashboardCtrl.js"></script>
<!-- your app's js -->
</body>
</html>
app.js
var app = angular.module('myApp', ['ionic']);
app.run(function($ionicPlatform, $timeout) {
$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();
}
});
});
routes.js
app.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('app.dashboard', {
url: '/home',
abstract: true,
templateUrl: "./templates/dashboard.html",
controller: 'DashboardCtrl'
})
.state('app.login', {
url: '/login',
abstract: true,
templateUrl: "./templates/login.html",
controller: 'LoginCtrl'
})
});
login.html
<ion-view view-title="login">
<ion-content class="padding">
LOGIN
</ion-content>
</ion-view>
dashboard.html
<ion-view view-title="dashboard">
<ion-content class="padding">
DASHBOARD
</ion-content>
</ion-view>
console
Please help me