我想创建一个外部重定向,但为了使所有路由保持一致,我认为在路由器状态配置下做所有事情(包括外部重定向)会很好.
所以:
const appRoutes: Routes = [
{path: '', component: HomeComponent},
{path: 'first', component: FirstComponent},
{path: 'second', component: SecondComponent},
{path: 'external-link', /*would like to have redirect here*/}
];
Run Code Online (Sandbox Code Playgroud)
UPD:我不想像@koningdavid建议的那样使用空组件.对我来说这个解决方案看起来很奇怪.对于没有虚拟组件的情况,这应该是非常容易实现的.
我正在尝试通过https://github.com/ng-bootstrap/ng-bootstrap将bootstrap模块添加到我的ng2应用程序中.但总是得到这个错误:
这是我的索引文件,也许我的文件中有错误?index.html的:
<html>
<head>
<title>MyApplication</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">-->
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/@ng-bootstrap/ng-bootstrap"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<app>Loading...</app>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
/**
* System configuration for Angular 2 samples
* Adjust as necessary for …Run Code Online (Sandbox Code Playgroud)我需要从Shadow DOM获取元素并进行更改.我怎么能这样做?
<div>
<input type="range" min="100 $" max="3000 $">
</div>
Run Code Online (Sandbox Code Playgroud) 我现在有:
<span>{{(price | currency: 'EUR': true)}}</span>
并以标准格式1,000.00输出
但我需要这种格式1.000,00