this.subscription = this.router.events.subscribe((event:Event) => {
console.log(event.url); ##### Error : Property 'url' does not exist on type 'Event'.
}
Run Code Online (Sandbox Code Playgroud)
Typescript无法识别Angular Router中内置的Event类型的属性.tsd上有什么东西我可以用来解决这个问题吗?Event是NaviagationEnd,NavigationStart类的超类
如何使用 SystemJS 和使用这个 system.config.js 文件将我刚刚从 npm 下载的新包添加到我的 Angular 2 组件中。下面的代码是由一个入门包为我生成的。我试图在这个文件的地图和包部分放置模块的链接,但它似乎不起作用。我只想知道如何获取位于 node_modules 中的下划线 js 等库并将其输入到此文件中,以便我可以轻松地将文件导入到我的打字稿角度组件中。
var isPublic = typeof window != "undefined";
(function(global) {
var map = {
'app': 'client', // 'dist',
'@angular': (isPublic)? '@angular' : 'node_modules/@angular',
'@angular/router': (isPublic)? '@angular/router' : 'node_modules/@angular/router',
'angular2-in-memory-web-api': (isPublic)? 'angular2-in-memory-web-api' : 'node_modules/angular2-in-memory-web-api',
'rxjs': (isPublic)? 'rxjs' : 'node_modules/rxjs',
'ng-semantic': (isPublic)? 'ng-semantic' : 'node_modules/ng-semantic'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', …Run Code Online (Sandbox Code Playgroud) 在导航中,我有一个突出的红色框。我希望该红色框与所有Divs重叠。我为其设置了一个边距,以便将其与我放入黑盒中的其他元素隔开。问题在于它的边距还会影响单独元素的子元素的布局。当我向以下部分的子元素添加负边距时,它确实重叠了,但是我希望红色框位于顶部。我使用z-index,它似乎不起作用。
这是我在Jsfiddle上的示例:http : //jsfiddle.net/1qsuvhnd/29/
的HTML
<nav>
<div id="ribbon"></div>
</nav>
<div id="context">
<div class="link"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
的CSS
#context {
width: auto;
padding: 20px;
height: 300px;
background-color: blue;
z-index: 1;
}
#context .link {
float: Left;
height: 260px;
width: 300px;
margin-left: -140px;
background-color: White;
z-index:1 !important;
}
nav {
width: auto;
height: 65px;
background-color: black;
z-index:99 !important;
clear:both;
}
nav #ribbon {
float: left;
margin: 0px 50px;
Width: 65px;
height: 130px;
background-color: red;
z-index= 99;
}
Run Code Online (Sandbox Code Playgroud)