本文整理汇总了TypeScript中angular2/src/router/instruction.stringifyInstruction函数的典型用法代码示例。如果您正苦于以下问题:TypeScript stringifyInstruction函数的具体用法?TypeScript stringifyInstruction怎么用?TypeScript stringifyInstruction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stringifyInstruction函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should generate URLs from the root component when the path starts with /', () => {
router.config([new Route({path: '/first/...', component: DummyParentComp, as: 'firstCmp'})]);
var instruction = router.generate(['/firstCmp', 'secondCmp']);
expect(stringifyInstruction(instruction)).toEqual('first/second');
instruction = router.generate(['/firstCmp/secondCmp']);
expect(stringifyInstruction(instruction)).toEqual('first/second');
});
示例2: Route
() => {
router.config(
[new Route({path: '/one/two/:three', component: DummyComponent, as: 'number-url'})]);
var instruction = router.generate(['/number-url', {'three': 'three', 'four': 'four'}]);
var path = stringifyInstruction(instruction);
expect(path).toEqual('one/two/three?four=four');
});