javascript - 刷新页面后变为空白(AngularJS 状态)
问题描述
当我单击主页上的按钮时,它会转到正确的页面并正确加载所有数据。但在那之后,当我刷新页面数据时,不会加载并显示空白页面。
下面显示我的状态路由器功能。
.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'
]
谢谢!
解决方案
推荐阅读
- r - 如何更改 PollutionRose 函数的比例?
- python - 找不到 libOpenCL.so 文件
- html - 有没有办法在 Bootstrap5 的边框标题中添加文本?
- apache - Shopware 6 与我们的 Web 开发设置(Apache 和 ACL)不兼容
- android - LazyColumn 比垂直滚动的 Column 慢
- html - 如何使用 Flex 和 Space-between 直线对齐项目
- html - Pre 元素中的 Div 元素在行上方和下方添加了不需要的空白
- python - 我如何使用设置交集方法来确定一个刺是一个 pangram?
- firebase-realtime-database - Firebase 安全规则运营费用
- powershell - 使用 powershell 将 ACL 权限更改为 2500 个文件夹