I have user interface routes defined in ionic form and made the console.log controller in the controller, but my problem is that I switch between urls using ng-href = "/ # / LINK", then none the data is not displayed on the console, but when I refresh the same page I can see the data in the console ... let me know what I'm 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' } } })
Below 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 just have - <a ng-href="/#/roomone/MY_ID" />Dummy Link</a>
Problem. Only when updating (F5) do I get console values ββsuch as "I am alone in the room", "not by simply navigating the link. Let me know what I'm doing wrong.
source share