Passing data and react to value change in that vue

Hi , facing a little issue regarding reacting to the passage for the data passed into a new page.
this is how i’m passing my data when i navigate.


         	var data = Observable(
		{name: "zagggiid"},
		{name: "dsfsf"},
		{name: "qslkj"},
		{name: "aaaa"}
	)
	var navigationData = Observable()

	function NavigateTo(arg){
		navigationData.value = arg.data
		router.push("barB")
	}
    
	module.exports = {
		data: data,
		NavigateTo: NavigateTo,
		navigationData: navigationData.map(function(x){
			return {
				name: x.name,
			}
		}),
	}

passing data , works well , but when i comes to react to change (that value displayed in the parameter changed) , nothing happen , it is fine to do it like this? or there is an another solution. many thanks

Hi,

Sorry, I can’t understand your question. There is not enough relevant code to understand what is going on, what you are trying to do or what the problem i.

1- i have some items in my homes page (the data Observable).
2- i would like when i click to one, navigate inside it and display his data (here the name) to his own page (passing data between the home and the item page)
3- this piece of code , is what i’m using to pass data , between the home and the new page item when i navigate

    var navigationData = Observable()

    function NavigateTo(arg){
        navigationData.value = arg.data
        router.push("barB")
    }

4- data are well received between the home and item page but, for example if i change the data name in this item page, the parameter passed doesn’t change , it stay the same until i get out of the item page and come into it again.

Hi,

Forget about navigationData, that seems like a broken pattern.

Sounds like what you want to do is:

function NavigateTo(arg){
    router.push("barB", { data: arg.data } );
}

And then on your page:

this.Parameter.onValueChanged(module, function(p) { 
    p.data // holds the data
});

Thank you anders it worked, but do we have a way to use this parameter data in js , and not just in ux side.
i’m using this code to get the data (see below).
and i need to use it in js for doing some comparaison and handle some ux states
doing publication.value.something doesn’t works , can you help me please

var publication = this.Parameter.map(function(p) { 
    return p.data
});

Hi again - yes, you have to do that inside the map function. The parameter is not available synchronously, so you can’t use it during the initial execution of the module.

many thanks @anders i have figure it out