背景
我有一个大角度的应用程序与许多形式的许多项目。
我有行动对象的清单。
这些操作都有示意图。
这些动作在下拉式的动作中各不相同。(下拉列表的内容取决于该行为是哪个公司的)
除非我重新加载页面,否则这些下拉内容不会更改。
问题
如何重新加载窗口,然后进行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,但是我有角用户界面路由器。
编辑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
我在这里提出了一个新的问题,我认为这个问题的核心是:Reload a pages cache, then go to a new page
发布于 2018-07-31 16:47:58
此答案仅在输入操作页时使用$window执行reload。但是通过使用哈希来避免递归。
var currentHref = $window.location.href
if (!currentHref.includes("refresh")) {
$window.location.href = $window.location.href + "#refresh"
$window.location.reload(true);
}下的更多解释
此代码启用重定向后的完全重新加载。它在进入新页面后运行。
第一次,url不包含“刷新”,因此$window.location.href更改为包含“刷新”。但是这个不重新加载页面。只有在重新加载页面并清除缓存后的行。但是,只有在添加了哈希之后才会重新加载。
因此,我在没有无限循环的情况下完成了一个完整的重新加载,这个循环在进入页面时会自动发生。
https://stackoverflow.com/questions/51597991
复制相似问题