本文整理汇总了TypeScript中@uirouter/core.UrlService.url方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UrlService.url方法的具体用法?TypeScript UrlService.url怎么用?TypeScript UrlService.url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@uirouter/core.UrlService
的用法示例。
在下文中一共展示了UrlService.url方法的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'] });
});