如果我想從Angular中的URL獲得特定值,我正在查看如何解析這些數據。角度在URL中獲得值
例子:
http://localhost:1337/doc-home/#/tips/5?paginatePage=1
我想要得到的 「5」
HTML:
<a href="#/tips/comments/{{ tip.id }}?groupid={{ ????? }}" class="btn-yellow">Add/View Comments</a>
module.js
.when('/tips/comments/:group?id', {
templateUrl: 'partials/comments.html'
controller.js
.controller('TipCommentsCtrl',
function ($http, $scope, $routeParams, Categories, Tip, $location, error, $sce) {
UPDATE
我越來越接近感謝你們從所有的答案。
我張貼另一個問題,這應有助於解釋我的問題是什麼
Angular routeParams not working URL is changing
請參閱使用網址更新其他問題 –