本文整理汇总了TypeScript中@uirouter/core.UrlService类的典型用法代码示例。如果您正苦于以下问题:TypeScript UrlService类的具体用法?TypeScript UrlService怎么用?TypeScript UrlService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UrlService类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: platformBrowserDynamic
platformBrowserDynamic().bootstrapModule(KyloModule).then(platformRef => {
const injector: Injector = platformRef.injector;
const upgrade = injector.get(UpgradeModule) as UpgradeModule;
// The DOM must be already be available
upgrade.bootstrap(document.body, ["kylo"]);
// Initialize the Angular Module (get() any UIRouter service from DI to initialize it)
const url: UrlService = injector.get(UIRouter).urlService;//getUIRouter(injector).urlService;
// Instruct UIRouter to listen to URL changes
url.listen();
url.sync();
});
开发者ID:prashanthc97,项目名称:kylo,代码行数:14,代码来源:main.ts
示例2: platformBrowserDynamic
platformBrowserDynamic().bootstrapModule(SampleAppModuleAngular).then(platformRef => {
// Initialize the Angular Module
// get() the UIRouter instance from DI to initialize the router
const urlService: UrlService = platformRef.injector.get(UIRouter).urlService;
// Instruct UIRouter to listen to URL changes
function startUIRouter() {
urlService.listen();
urlService.sync();
}
platformRef.injector.get<NgZone>(NgZone).run(startUIRouter);
});
开发者ID:ui-router,项目名称:sample-app-ng1-to-ng2,代码行数:13,代码来源:main.ts
示例3: 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');
});
开发者ID:angular-ui,项目名称:ui-router,代码行数:35,代码来源:urlMatcherFactorySpec.ts
注:本文中的@uirouter/core.UrlService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论