当通过$ state.go传递$ stateParams时,当我直接点击链接时它正确,但在页面刷新后或通过另一个窗口打开时变为空.
我有以下功能:
$scope.urlvalues = function(url,page) {
var result = {url:url, page:page};
$state.go("detailpage", result);
}
Run Code Online (Sandbox Code Playgroud)
我的州看起来像这样:
.state('detailpage', {
url: "/page/overview",
templateUrl: "/page_details.html",
controller: "PageDetailsController",
params: {
url: null,
page: null
},
})
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我有一个Angular应用程序使用ui-router,每当我刷新页面时我都会遇到问题.我正在使用嵌套视图,命名视图来构建应用程序.每当我刷新页面时,ui-router都不会重新加载当前状态,只是将页面留空.
页面加载$state.current等于
Object {name: "", url: "^", views: null, abstract: true}
Run Code Online (Sandbox Code Playgroud)
我正在从.json文件中读取导航$http并循环遍历各个州.所以这就是我能展示的:
stateProvider.state(navElement.stateName, {
url: navElement.regexUrl ? navElement.regexUrl : url,
searchPage: navElement.searchPage, //something custom i added
parent: navElement.parent ? navElement.parent : "",
redirectTo: navElement.redirectTo,
views: {
'subNav@index': {
templateUrl: defaults.secondaryNavigation,
controller: 'secondaryNavigationController as ctrl' //static
},
'pageContent@index': {
template: navElement.templateUrl == null
? '<div class="emptyContent"></div>'
: undefined,
templateUrl: navElement.templateUrl == null
? undefined
: navElement.templateUrl,
controller: navElement.controller == …Run Code Online (Sandbox Code Playgroud)