【发布时间】:2016-01-26 09:18:19
【问题描述】:
我目前正在将我的应用程序切换到单页应用程序。我在配置我的 ngRoute 时遇到了一些问题。 我想要的是使用 ?id=.
将 ID 发送到 templateUrl我该怎么做? 这是我的代码:
app.config(["$routeProvider", function($routeProvider) {
$routeProvider
.when('/testing/:id', {
templateUrl: 'templates/testing.php?id=:id'
});
}]);
它现在传递 ":id" 作为 ID 的值。这很明显,但是如何让它发送在 URL 中传递的“:id”?
例如:
/testing/45
变成:
app.config(["$routeProvider", function($routeProvider) {
$routeProvider
.when('/testing/45', {
templateUrl: 'templates/testing.php?id=45'
});
}]);
【问题讨论】:
标签: angularjs