UI-Router duplicate insatnce with different parameters


#1

Hi,

I have noticed that, whenever a $state.go() is applied to a state with parameter in UI-Router, a new instance of DOM/directive/module/controller are being created.

For example:

.state('tab.activity-chat', {
	url: '/activity-chat/:activityId',
	views: {
		'tab-my-activities': {
			template: '<activity-chat></activity-chat>'
		}
	}
})

$state.go('tab.activity-chat', { activityId: activity._id});

<activity-chat></activity-chat> - this is my module that initializing every time I’m routing to
’tab.activity-chat’ with different parameter (activityId).

In browser I can see duplicate HTML code :

How can I stop new instances of my module(directive/controller/view)?
I want to use the same controller, same scope and same HTML content for any data that $stateParams passed.

Thank you in advance!


#3

Hi! Did you ever find a solution?