角度重新加载窗口,然后进入新状态 [英] Angular reload window then go to a new state
问题描述
我有一个大型的角度应用程序,其中包含许多项目的多种形式.
I have a large angular app with many forms for many items.
我有动作对象列表.
这些动作具有模式形式.
These actions have schemaforms.
这些动作形式的下拉菜单与一个动作与另一个动作不同. (下拉菜单的内容取决于该操作是哪个公司的子公司)
These actions form's dropdown's differ from one action to the next. (the dropdown's contents depends on which company the action is a child of)
除非我重新加载页面,否则这些下拉列表的内容不会更改.
These dropdowns contents were not changing unless I reloaded the page.
如何重新加载窗口然后进行state.go更改?
How do I do a window reload then a state.go change?
$scope.goToActionWizardFull = function(CUuid, AUuid) {
$window.location.reload();
$state.go('actionWizard', { companyUuid: CUuid, uuid: AUuid });
}
当前问题:
该代码应该从cookie/本地存储/etc中清除较旧的架构,以便下拉菜单显示当前操作的下拉菜单内容,而不是最后一个操作的下拉菜单内容. 然后,将您带到新操作的页面.
Current problem:
This code is supposed to clear the older schema from the cookies/local storage/etc so that the dropdowns show the current action's dropdown contents not the last action's dropdown contents. Then take you to the new action's page.
相反,此代码将用户带到actionWizard页面,然后将他们带回到公司页面.
This code, instead, takes the user to the actionWizard page, then takes them back to the company page.
我正在从一个名为sharedVars的文件中加载下拉内容:
I am loading the dropdown contents from a file called sharedVars here:
.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
整个表单的HTML:
<form sf-schema="actionSchema" sf-form="actionForm" sf-model="actionModel" name="submittableActionForm">
</form>
编辑3
我的bower.json看起来像:
EDIT 3
my bower.json looks like:
{
"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
So, I do not have ngRoute, but I do have angular-ui-router
我尝试使用$ state重新加载,但是下拉列表仍然无法有效地重新加载.因此,此处的第一行似乎没有任何作用.
I have attempted to reload using $state but the dropdown still does not reload effectively. So, the 1st line here seems to have no effect.
$state.go($state.current, {}, {reload: true});
$state.go('actionWizard', { companyUuid: CUuid, uuid: AUuid });
编辑5
这也不起作用:
EDIT 5
This also does not work:
$state.transitionTo($state.current, $stateParams, {
reload: true,
inherit: false,
notify: true
})
$state.go('actionWizard', { companyUuid: CUuid, uuid: AUuid });