4
我正在使用UI-Router
。這是我的國家之一,對此我通過ui-sref
路由:
.state("community", {
url: "/community/:community_id",
controller: "CommunityCtrl",
templateUrl: "/static/templates/community.html"
})
在我的模板之一,從我去「社區」狀態:
<div ui-sref="community({community_id: community.community_id})"></div>
這裏是我的社區對象:
{
name: 'Community name',
community_id: 11 //int, not a string
}
正如你所看到的,鍵'community_id'包含一個int值而不是字符串值。然而,當我通過$stateParams
訪問此參數,我得到:
community_id: "11" //string
爲什麼我得到一個字符串?
@RadimKöhler只有一個問題,對於'date'類型,我們需要指定一個格式? –
@PankajParkar希望你能在這裏得到答案:https://github.com/angular-ui/ui-router/blob/master/src/urlMatcherFactory.js#L42 –
@RadimKöhler我明白了......我需要考慮在我的應用程序重構..謝謝很多人.. +1讚賞幫助的額外問題.. –