Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个可选列表和一个过滤区域,用户可以在其中单击第一个字母:ABCD 等
如果用户单击 A,我希望 URL 为/products/a,然后我想过滤所有以字母开头的产品a。我不完全确定如何做到这一点。
/products/a
a
想法?
$scope.startsWithFilter = function(artist) { var startMatch = new RegExp($scope.filterLetter, "i"); return artist.name.substring(0, 1).match(startMatch); }