本文整理匯總了TypeScript中@uirouter/core.UrlService.path方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript UrlService.path方法的具體用法?TypeScript UrlService.path怎麽用?TypeScript UrlService.path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@uirouter/core.UrlService
的用法示例。
在下文中一共展示了UrlService.path方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should allow path param arrays with '-' in the values", function() {
const m = $umf.compile('/foo/:param1[]');
expect(m.exec('/foo/')).toEqual({ 'param1[]': undefined });
expect(m.exec('/foo/bar\\-')).toEqual({ 'param1[]': ['bar-'] });
expect(m.exec('/foo/bar\\--\\-baz')).toEqual({ 'param1[]': ['bar-', '-baz'] });
expect(m.format({ 'param1[]': [] })).toEqual('/foo/');
expect(m.format({ 'param1[]': ['bar-'] })).toEqual('/foo/bar%5C%2D');
expect(m.format({ 'param1[]': ['bar-', '-baz'] })).toEqual('/foo/bar%5C%2D-%5C%2Dbaz');
expect(m.format({ 'param1[]': ['bar-bar-bar-', '-baz-baz-baz'] })).toEqual(
'/foo/bar%5C%2Dbar%5C%2Dbar%5C%2D-%5C%2Dbaz%5C%2Dbaz%5C%2Dbaz'
);
// check that we handle $location.url decodes correctly
$url.url(m.format({ 'param1[]': ['bar-', '-baz'] }));
expect(m.exec($url.path(), $url.search())).toEqual({ 'param1[]': ['bar-', '-baz'] });
// check that we handle $location.url decodes correctly for multiple hyphens
$url.url(m.format({ 'param1[]': ['bar-bar-bar-', '-baz-baz-baz'] }));
expect(m.exec($url.path(), $url.search())).toEqual({ 'param1[]': ['bar-bar-bar-', '-baz-baz-baz'] });
// check that pre-encoded values are passed correctly
$url.url(m.format({ 'param1[]': ['%2C%20%5C%2C', '-baz'] }));
expect(m.exec($url.path(), $url.search())).toEqual({ 'param1[]': ['%2C%20%5C%2C', '-baz'] });
});