142
rated 0 times
[
148]
[
6]
/ answers: 1 / hits: 15393
/ 10 Years ago, thu, october 23, 2014, 12:00:00
I would like to change the route of an angularjs application build with ionic framework, but the route didn't change
this is my code of app.js
angular.module('starter', ['ionic', 'starter.controllers'])
.state('app.annuaire.menuitempage', {
url: /menuitempage/:ID,
views: {
'menuContent' :{
templateUrl: templates/menuItemPage.html,
controller: function($stateParams){
$stateParams.ID ;
}
}
}
})
.state('app.annuaire', {
url: /annuaire,
views: {
'menuContent' :{
templateUrl: templates/annuaire.html,
controller: 'MenuItemCtrl'
}
}
})
And this is the code of my controller
angular.module('starter.controllers', [])
.controller('MenuItemCtrl', function($scope, $http, $location) {
$scope.itemsMenu = {};
var responsePromise = $http.get(http://monguidepratique.com/mobile/getCategories.php?parent_id=0);
responsePromise.success(function(data, status, headers, config) {
//alert(data);
$scope.itemsMenu = data;
});
responsePromise.error(function(data, status, headers, config) {
alert(AJAX failed!);
});
$scope.itemClick = function(path){
alert(1);
$location.path(path);
};
})
And this is my html code in annuaire.html
<div class=col ng-click=itemClick('/menuitempage/1628')><img class=img_menu src=img/home.png><p class=titre_center>Accueil</p></div>
More From » angularjs