I'm kind of a noob in Ionic, and I need help / advice to create something that sounds simple. I want to have one page, consisting of several contents, the idea is to have several views on one page, each of which is associated with a specific controller.
Here is my code:
index.html content:
<ion-pane>
<ion-nav-view></ion-nav-view>
<ion-view ng-controller="FirstController">
<ion-content>
</ion-content>
</ion-view>
<ion-view ng-controller="ScdController">
<ion-content>
</ion-content>
</ion-view>
</ion-pane>
In my app.js app:
angular.module('app', [])
.controller('FirstController', function($scope) {
})
.controller('ScdController', function($scope) {
});
In my config.routes.js:
angular.module('app')
.config(configure);
function configure($stateProvider){
$stateProvider
.state('first', {
url: '/',
templateUrl: 'templates/first.html',
controller: 'FirstController'
})
.state('second', {
url: '/',
templateUrl: 'templates/second.html',
controller: 'ScdController'
});
}
The templates are very simple:
first.html:
<div>first</div>
second.html:
<div>Second</div>
Now nothing is displayed.
What do you guys think?
Thank you for your help!
source
share