When defining the state, you need to specify that the state is expecting a state parameter. Here it's named as “myobjectparameter”.
.state("app.somestate.someotherstate", {
url: "/someotherstate/:myobjectparameter",
templateUrl: "sometemplate.tpl.html",
controller: "SomeTemlateController",
})
And when you are navigating to “app.somestate.someotherstate” and specifying the value for “myobjectparameter”, you need to convert your object to a JSON string.
$state.go("app.somestate.someotherstate", {
"myobjectparameter": JSON.stringify({
"property1": "Property Value1",
"property2": "Property Value2"
})
});
And from “app.somestate.someotherstate” state, you need to parse "$stateParams.myobjectparameter" which was passed as a string to a JSON object.
var myObjectParameter = JSON.parse($stateParams.myobjectparameter);
Regards,
Jaliya
No comments:
Post a Comment