I have a form that allows to update all the fields of an element. After the update succeeded, I want to redirect to the page with the list of all elements. I want to pass this page the message "update succeeded".
In the controller I pass a parameter to the state provider in this way:
$state.go('list', { message: "Update success" }, { reload: true });
In the state provider:
function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('list',
{
url: '/List',
templateUrl: 'elementsList.html',
params: {
message:
function ($stateParams) {
return $stateParams.message;
}
}
})
Is this the correct way to pass a string parameter to an html page? What is the syntax in the html page to show the parameter value?
Thanks.