Yes sorry it was not enough clear.
I’d like to have multiple views, that could behave separately. That’s why I talked about ui-router, but I wanted to know if it would be compatible or not.
I just tried ui-router with Ionic, but a very strange bug appears.
Here is the app.js:
$stateProvider
// Login page
.state('login', {
url: '/login',
views: {
"mainContent": {templateUrl: 'login/login.tpl.html',
controller: 'LoginController'}
}
})
// When connected
.state('dashboard', {
url: '/dashboard',
views: {
"mainContent": {templateUrl: 'dashboard/dashboard.tpl.html'},
"sideMenu": {templateUrl: 'navigationPanel/accounts.tpl.html'}
}
})
;
The index.html, to define the two views: mainContent and sideMenu
<side-menus>
<!-- Center content -->
<pane side-menu-content>
<div ui-view="mainContent"></div>
</pane>
<!-- Left menu -->
<side-menu side="left">
<div ui-view="sideMenu"></div>
</side-menu>
</side-menus>
And here is the login page:
Template
<div class="list">
<label class="item item-input">
<input type="text" name="login" placeholder="username" ng-model="user.login"/>
</label>
<label class="item item-input">
<input type="password" name="password" placeholder="password" ng-model="user.password"/>
</label>
</div>
<button class="button button-block button-primary" ng-click="login()">Login</button>
The controller
$scope.user = {};
$scope.login = function() {
blalabla...
}
So what is happening? It took me 1h to understand it
At first, the bindings user.login and login.password acts very strangely. When I type (push a character with keyboard), only the last letter typed populate the $scope.user.login and $scope.user.password (checked with Batarang). And the input is left empty. I thought about a conflict between Ionic scope and mine.
BUT, if I open the side menu, and then i close it, NOW the binding is working. I have no clue what’s going on.
I hope you could reproduce it.