背景
我有一个大型角度应用程序,其中包含许多项目的多种形式。
我有动作对象列表。
这些动作有模式。
这些操作表单的下拉菜单因一项操作而异。(下拉列表的内容取决于该操作是哪个公司的子项)
除非我重新加载页面,否则这些下拉列表内容不会改变。
问题
如何重新加载窗口然后更改 state.go?
代码
$scope.goToActionWizardFull = function(CUuid, AUuid) {
$window.location.reload();
$state.go('actionWizard', { companyUuid: CUuid, uuid: AUuid });
}
当前问题:
此代码应该从 cookie/本地存储/等中清除旧模式,以便下拉菜单显示当前操作的下拉内容,而不是最后一个操作的下拉内容。然后将您带到新操作的页面。
相反,此代码将用户带到 actionWizard 页面,然后将他们带回公司页面。
额外的上下文
我在这里从一个名为 sharedVars 的文件中加载下拉内容:
.controller('ActionController', function ($scope, $stateParams, $state, $window, sharedVars, Company, Action) {
我在这里加载它:
$scope.actionSchema = sharedVars.getActionSchema();
然后在这里改变它:
$scope.actionSchema.properties.RDAInput.items.properties.input_location.enum = $scope.actionSchema.properties.RDAInput.items.properties.input_location.enum.concat(eachRDSchemaProperty['name'])
然后我加载表格。
这一切都在http://schemaform.io
编辑 2
整个表单的 HTML:
<form sf-schema="actionSchema" sf-form="actionForm" sf-model="actionModel" name="submittableActionForm">
</form>
编辑 3
我的 bower.json 看起来像:
{
"name": "isp",
"appPath": "src/main/web",
"moduleName": "ispApp",
"version": "0.0.1",
"dependencies": {
"jquery": "2.1.1",
"angular": "1.6.1",
"json3": "3.3.2",
"angular-ui-router": "0.4.1",
"angular-resource": "1.6.1",
"angular-sanitize": "1.6.1",
"checklist-model": "0.10.0",
"jsog": "1.0.7",
"angular-schema-form": "^0.8.13",
"angular-schema-form-bootstrap": "^0.2.0",
"bootstrap": "3.3.7",
"angular-cookies": "1.6.1"
},
"resolutions": {
"angular": "1.6.9"
},
"install": {
"path": "src/main/web/bower_components"
}
}
所以,我没有 ngRoute,但我有 angular-ui-router
编辑 4
我尝试使用 $state 重新加载,但下拉列表仍然无法有效地重新加载。所以,这里的第一行似乎没有效果。
$state.go($state.current, {}, {reload: true});
$state.go('actionWizard', { companyUuid: CUuid, uuid: AUuid });
编辑 5
这也不起作用:
$state.transitionTo($state.current, $stateParams, {
reload: true,
inherit: false,
notify: true
})
$state.go('actionWizard', { companyUuid: CUuid, uuid: AUuid });
编辑 6
我在这里提出了一个新问题,我相信它更接近问题的核心:重新加载页面缓存,然后转到新页面