首页 > angular js $location 跳转问题

angular js $location 跳转问题

使用$stateProvider的state规定url,
$stateProvider .state('questions', { abstract: true, url: "/questions", templateUrl: "common/content.html", }) .state('questions.tophot', { url: "/tophot", templateUrl: "questions/tophot.html", }) .state('ask', { url: "/ask/:questionId", templateUrl: "ask/ask.html", })
在js中使用$location.path如何调用一个带有参数的rest请求,比如访问/ask/23


使用$state服务。

$state.go('ask',{questionid:23});

对于状态state:ask,用$location.url('/ask/23')就可以访问了

【热门文章】
【热门文章】