2
我想在一些頁面中使用可選參數ui sref,但問題是當我不通過參數ui sref它加載控制器兩次。 我想有一個可選的查詢參數。有更好的方法來做到這一點?角ui路由器可選查詢參數加載控制器兩次
$stateProvider
.state('play', {
url : "/lottery/:id/:isFree",
controller : "myController",
templateUrl: "client/play/index.html"
});
ui-sref="play({id: game.id, isFree:4}) // this is working fine.
ui-sref="play({id: game.id}) // this is reloading the controller twice