Когда я нажимаю кнопку, расположенную на моей домашней странице, она переходит на правильную страницу и правильно загружает все данные. Но после этого при обновлении страницы данные не загружаются и отображаются пустые страницы.
Ниже показано, как работает мой маршрутизатор состояния.
.state 'opportunity.new.connections',
url: '/connections/:connectionType'
params:
opportunityId: null
opportunity: null
connectionType: null
activeDropDown: null
template: '<opp-profile-custom-object-connection
connections="connections"
custom-object-type="customObjectType"
custom-connection-types="customConnectionTypes"
custom-object="customObject"
></opp-profile-custom-object-connection>'
controller: ['$scope', 'connections', 'customObjectType', 'customConnectionTypes', 'customObject',
($scope, connections, customObjectType, customConnectionTypes, customObject) ->
$scope.connections = connections
$scope.customObjectType = customObjectType
$scope.customConnectionTypes = customConnectionTypes
$scope.customObject = customObject
]
resolve:
connections: ['clickConnections', '$stateParams', (clickConnections, $stateParams) ->
opportunity =
id: $stateParams.opportunityId
clickConnections.getConnectionsByOpportunityAndType(opportunity, $stateParams.connectionType).then (response) ->
response
.catch ->
$state.go 'notFound'
]
customObjectType: ['$stateParams', 'clickApi', '$q', '$state', ($stateParams, clickApi, $q, $state) ->
clickApi.getData '/custom-object-types', null, { query: 'canonicalPlural="' + $stateParams.connectionType + '"' }
.then (response) ->
response.data._embedded.customObjectTypes[0]
.catch ->
$state.go 'notFound'
]
customConnectionTypes: ['$stateParams', 'customConnectionTypeService', 'CONNECTION_TYPE_OPPORTUNITY', 'customObjectType', ($stateParams, customConnectionTypeService, CONNECTION_TYPE_OPPORTUNITY, customObjectType) ->
customConnectionTypeService.getCustomConnectionTypesByFromAndToCategory(CONNECTION_TYPE_OPPORTUNITY, 'object' + customObjectType.id)
]
customObject: ['clickCustomObjects', 'customObjectType', (clickCustomObjects, customObjectType) ->
clickCustomObjects.getSelect2AjaxConfig
multiple: false
newable: ['customObject']
customObjectTypeId: customObjectType.id
]
activeDropDown: ['$stateParams', 'profileTabService', 'customObjectType', ($stateParams, profileTabService, customObjectType) ->
if $stateParams.activeDropDown then return $stateParams.activeDropDown
profileTabService.getLastAccessedConnectionType('opportunities', "object#{customObjectType.id}", null).then (selection) ->
$stateParams.activeDropDown = selection || 'standard'
]
Спасибо!