I want to pass a data from the state
to the controller, I would like the {{ projectName }}
be interpreted at the state
level (this state
) and returns its value (string) directly to the controller.
Is there a way to do this by the resolve
(the code in the resolve
was only for the test, but we can in fact retrieve the projectName by ProjectUtilService.getProjectName(project)
) or the onEnter
method or for example to execute a function at the same level of data.title
and which return the projectName
...?
.state({
name: 'project.detail.edit.headers.overlay.comment',
url: '/comment',
data: {
title: '{{ projectName }}'
},
component: 'iadAgentMyIadComment',
resolve: {
projectName: (project, ProjectUtilService) => {
ProjectUtilService.getProjectName(project)
}
}
})
EDIT :
getProjectName(project) {
return project.contactName
}
for example if ProjectUtilService.getProductName (project) returns "Richard Stallman" i want i found on my controller this.$state.current.data.title
which is equal to Richard Stallman