3
我使用的是有角度的ui路由器,并具有父级抽象状态(“home”)和两个子状态(“home.ports”和“home.editPort”)。州。 “home.state”是一个默认状态,所以在home.state加载时首先触发parent(“home”)状态,这会在resolve属性中触发http请求。我的子状态可以在服务器上进行更改,并可以更新父状态的列表。所以,问题是,当我要孩子的状态(“home.editPort”),然后回来home.ports其未触发的家乡,以获取更新的房源子状态不会触发角状态下的父状态
.state('home', {
url: "/home",
templateUrl: "dest/partials/home/_home.html",
controller: "HomeController",
abstract : true,
data: {
requireLogin: true
},
resolve: {
// making an http request
jqTreeData : ['httpService', 'BASE_HOME_URL', function (httpService, BASE_HOME_URL) {
var obj = {
url : BASE_HOME_URL + "emulationDetails",
responseType : "json",
method : "GET"
};
return httpService.makeAjax(obj);
}]
}
})
.state('home.ports', {
url: "/ports",
//templateUrl: "dest/partials/home/ports/_portList.html",
template: "<custom-Table tbl-Caption='Port Listing'></custom-Table>",
controller: "PortsListController"
})
.state('home.editPort', {
url: "/editPort",
template: "<h1>Edit ports</h1>"
});
你是如何重定向的孩子状态? –
我在我的应用程序中有几个链接(锚标签),当用户点击任何相应的状态时触发($ state.go(...)) –