Hello,
I’m new to Ionic, and I’m struggling with something simple.
I’ve used the Ionic tab template. I’ve a list of “conversations”, when you click on it, you’ll arrive on a “Detail Page”, and when you click on a button on this page, you’ll arrive on a “Second Detail Page”.
My problem is that I want my “Second Detail Page” to receive the data from the first “Detail Page” (name, lastText… defined in service.js)…
But, I don’t succeed in doing that!
Here is what I’ve tried…
APP JS
.state(‘tab.chat-detail’, {
url: ‘/chats/:chatId’,
views: {
‘tab-chats’: {
templateUrl: ‘templates/chat-detail.html’,
controller: ‘ChatDetailCtrl’,
}
}
})
.state('tab.chat-db_connect', {
url: '/chats/:chatId',
views: {
'tab-chats': {
templateUrl: 'templates/chat-db_connect.html',
controller: 'DB_connect',
}
CONTROLLER JS
.controller(‘ChatDetailCtrl’, function($scope, $state, $window, $stateParams, Chats, $ionicPopup, $http) {
$scope.chat = Chats.get($stateParams.chatId);
$scope.db_connect = function() {
$state.go(‘chat-db_connect’);
};
. .controller(“DB_connect”, ["$scope", “Auth”,’$state’,
function($scope, Auth, $state, $stateParams, Chats) {
$scope.chat = Chats.get($stateParams.chatId);
}])