I've been trying to make this work, I think I'm missing something but I don't know what. I've tried with absolute paths and same problem. Perhaps the way I'm trying to link the states?
Tree view goes like this:
- app
- app.category
- app.category.category-detail
I can navigate from app
, to app.category
but I can't go any further, here are my routes:
.state('app.category', {
url: "/category?catId",
views: {
'menuContent': {
templateUrl: "templates/category.html",
controller: "CategoryCtrl",
params: ['catId ']
}
}
})
.state('app.category.category-detail', {
url: "/category-detail",
views: {
'menuContent': {
templateUrl: "templates/category-detail.html",
controller: "DirectoryDetailCtrl",
params: [ 'catId' ]
}
}
})
This is my category.html
<ion-view>
<ion-nav-bar class="bar-dark nav-title-slide-ios7 bg-nav" ng-controller="NavCtrl">
<ion-nav-back-button class="button-clear" ng-click="myGoBack()">
<i class="ion-chevron-left blanco negrita"></i>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content class="directory-content padding-3 bg-gris">
<ion-list>
<ion-item ng-repeat="category in categories" class="item-thumbnail-left tarjeta">
<a ui-sref="app.category.category-detail">
{{category.categoryName}}
</a>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
Now, if I inspect this website with Chrome Dev Tools I can see the next link is generated:
<a ui-sref="app.category.category-detail" href="#/app/category/category-detail?catId=1" class="">
Category 1
</a>
But the view is not being loaded, and no error is shown.
category-detail.html
<ion-view>
<ion-nav-bar class="bar-dark nav-title-slide-ios7 bg-nav" ng-controller="NavCtrl">
<ion-nav-back-button class="button-clear" ng-click="myGoBack()">
<i class="ion-chevron-left blanco negrita"></i>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content class="category-content padding-3 bg-gris">
<h1>CATEGORY</h1>
</ion-content>
</ion-view>