I have routes defined in ionic, and console some data in controller, but my problem is I am having simple ng-href="/#/LINK" which is not consoling any data …but when I refresh the page I am able to see the data in console …let me know what I am doing wrong here.
Routes -
.state(‘app.roomone’, {
url: “/roomone/:id”,
views: {
‘menuContent’: {
templateUrl: “templates/roomone.html”,
controller: ‘RoomoneCtrl’
}
}
})
.state(‘app.roomtwo’, {
url: “/selecroom/:roomname/:roomindex”,
views: {
‘menuContent’: {
templateUrl: “templates/roomtwo.html”,
controller: ‘RoomtwoCtrl’
}
}
})
Following are my controllers -
.controller('RoomoneCtrl', function($scope, $rootScope) {
console.log("I am in room one");
});
.controller('RoomtwoCtrl', function($scope, $rootScope) {
console.log("I am in room two");
});
In my template - I am having simple – <a ng-href="/#/roomone/MY_ID" />Dummy Link</a>
Problem - Only on refresh(F5) I am getting console values like ““I am in room one”” not on simple navigation of link. Let me know what I am doing wrong.