I'm so early for ionic framework, and i'm trying to make mobile apps with ionic.
I was wondering how to change the overall look, if it makes the website quite by < a href="#">, but in ionic how it works (?)
I'm trying to add some code app.js :
config(function($stateProvider) {
$stateProvider
.state('expense', {
url: "/app/expense",
templateUrl: 'templates/add-expense.html'
})
});
this my code index.html :
<body ng-app="starter">
<ion-side-menus>
<ion-side-menu-content>
<ion-header-bar class="bar-header bar-dark">
<button class="button button-clear button-positive">Edit</button>
<div class="h1 title">23 Desember 20014</div>
<button class="button button-icon icon ion-navicon" menu-toggle="right"> </button>
</ion-header-bar>
<ion-content>
<div class="row green">
<div class="col">Income</div>
<div class="col price">3,550,000</div>
</div>
<div class="row expense orange">
<a class="col" href="#/app/expense">New Expense</a> <!-- try to link templates/add-expense.html -->
</div>
</ion-content>
</ion-side-menu-content>
<ion-side-menu side="right">
<a menu-close href="#" class="item">Home</a>
</ion-side-menu>
</ion-side-menus>
<body>
Anyone can help me? Thanks in advance.
There is updated working plunker. I am not expert of the ionic, so just basics are fixed/improved.
One issue is, that the config should be a method of something:
// wrong
config(function($stateProvider) {
...
The app is having config method
var app = angular.module('starter', ['ionic'])
...
app.config(function($stateProvider) {
$stateProvider
.state('expense', {
url: "/app/expense",
templateUrl: 'add-expense.html',
})
});
Also, I wrapped the content with <ion-nav-view>
, as a placeholder for the state expenses
(it must be injected into some ui-view=""
- unnamed anchor)
But these are few adjustments just to make it running, you should investigate the ionic more, read about it, to understand the concept, because e.g. the add-expsenses.html is not the way...
Check it here
You have problem with config section , should use this way.
And use also in html. And remove unused code on "add-expense.html" Use need to add template which you need to show.
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();
}
});
})
.config(function($stateProvider) {
$stateProvider
.state('expense', {
url: "/app/expense",
templateUrl: 'add-expense.html'
})
});
function ContentController($scope, $ionicSideMenuDelegate) {
$scope.toggleLeft = function() {
$ionicSideMenuDelegate.toggleLeft();
};
}