本文整理汇总了TypeScript中@uirouter/core.UrlService.search方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UrlService.search方法的具体用法?TypeScript UrlService.search怎么用?TypeScript UrlService.search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@uirouter/core.UrlService
的用法示例。
在下文中一共展示了UrlService.search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should be wrapped in an array if array: true', function() {
const m = $umf.compile('/foo?param1', { params: { param1: { array: true } } });
// empty array [] is treated like "undefined"
expect(m.format({ param1: undefined })).toBe('/foo');
expect(m.format({ param1: [] })).toBe('/foo');
expect(m.format({ param1: '' })).toBe('/foo');
expect(m.format({ param1: '1' })).toBe('/foo?param1=1');
expect(m.format({ param1: ['1'] })).toBe('/foo?param1=1');
expect(m.format({ param1: ['1', '2'] })).toBe('/foo?param1=1¶m1=2');
expect(m.exec('/foo')).toEqual({ param1: undefined });
expect(m.exec('/foo', {})).toEqual({ param1: undefined });
expect(m.exec('/foo', { param1: '' })).toEqual({ param1: undefined });
expect(m.exec('/foo', { param1: '1' })).toEqual({ param1: ['1'] });
expect(m.exec('/foo', { param1: ['1', '2'] })).toEqual({ param1: ['1', '2'] });
$url.url('/foo');
expect(m.exec($url.path(), $url.search())).toEqual({ param1: undefined });
$url.url('/foo?param1=');
expect(m.exec($url.path(), $url.search())).toEqual({ param1: undefined });
$url.url('/foo?param1=bar');
expect(m.exec($url.path(), $url.search())).toEqual({ param1: ['bar'] });
$url.url('/foo?param1=bar¶m1=baz');
if (angular.isArray($url.search()))
// conditional for angular 1.0.8
expect(m.exec($url.path(), $url.search())).toEqual({ param1: ['bar', 'baz'] });
expect(m.format({})).toBe('/foo');
expect(m.format({ param1: undefined })).toBe('/foo');
expect(m.format({ param1: '' })).toBe('/foo');
expect(m.format({ param1: 'bar' })).toBe('/foo?param1=bar');
expect(m.format({ param1: ['bar'] })).toBe('/foo?param1=bar');
expect(m.format({ param1: ['bar', 'baz'] })).toBe('/foo?param1=bar¶m1=baz');
});