Iu-Router problem


#1

hello everyone i’m using the ionic start myApp sidemenu.
I’ve add a new page and include it in the state provider as follow `config(function($stateProvider, $urlRouterProvider) {
$stateProvider

.state('app', {
  url: "/app",
  abstract: true,
  templateUrl: "templates/menu.html",
  controller: 'AppCtrl'
})

.state('app.search', {
  url: "/search",
  views: {
    'menuContent' :{
      templateUrl: "templates/search.html"
    }
  }
})

.state('app.browse', {
  url: "/browse",
  views: {
    'menuContent' :{
      templateUrl: "templates/browse.html"
    }
  }
})
.state('app.home', {
  url: "/home",
  views: {
    'menuContent' :{
      templateUrl: "templates/home.html",
      controller: 'homeCtrl'
    }
  }
})
.state('app.main', {
  url: "/main",
  views: {
    'menuContent' :{
      templateUrl: "templates/main.html",
    }
  }
})

.state('app.single', {
  url: "/playlists/:playlistId",
  views: {
    'menuContent' :{
      templateUrl: "templates/playlist.html",
      controller: 'PlaylistCtrl'
    }
  }
});`

but when i want to include a redirect link to any page from my main.html template it does not work .
any suggestion ?
I’m sure i’ve a mistake but where ? please help


#2

What do you mean by “redirect”? What do You mean that it doesn’t work? Do you see a blank page? Part of a page? Nothing happens?


#3

what i mean is that when i clic on a button it does not work the page nothing happens. the app remains on the same page


#4

Do you use a function for your button? Do you use <a href=""> or <a ui-sref="">


#5

i use
<button href="#/main/home" class="button button-block icon-right ion-ios7-search-strong button-royal" > Rechercher </button>

and in the app.js

 .state('main', {
  url: "/home",
  views: {
    'menuContent' :{
      templateUrl: "templates/home.html",
    }
  }
})

#6

One thing that comes to mind is that You can use ui-sref instead of href since You have Your states written so nicely :slight_smile: I will take a look at the rest this evening;)