我无法识别哪个组件在Angular中滚动,也使用Augury进行调试工具。
我有以下组件结构
Structure
|- main.ts
|- index.html
|- app
|- |- app.module.ts
|- |- app.components.ts
|- |- app.components.html
|- |- comp1
|- |- |- app.comp1.ts
|- |- |- app.comp1.html
|- |- |- comp2
|- |- |- |-
|- |- |- |- app.comp2.ts
|- |- |- |- app.comp2.html
我采取的步骤
this.window.window.scrollTo(0,0)
方法似乎没有帮助。并且记录y位置显示0.所以我认为它现在是需要调整的窗口。
滚动的窗口我不知道从哪里开始
我尝试实现一个提供Window
访问器的服务但是无论我在多大程度上向下滚动它似乎总是认为它在0位。
md-sidenav-container {
height: 100%;
position:fixed;
}
md-sidenav {
width: 300px;
background: white;
}
md-sidenav mat-sidenav {
height: 100%;
}
html, body, material-app, md-sidenav-container, .my-content {
margin: 0;
width: 100%;
height: 100%;
transform: initial !important;
}
<md-sidenav-container>
<md-sidenav #sidenav
mode="over"
align="end"
opened="false">
<md-list>
<!-- Side Nav -->
<div id="topNav">
<p> Filter By </p>
<div *ngFor="let filterType of scrollByTypes; let i = index" >
<md-divider></md-divider>
</div>
</div>
</md-list>
</md-sidenav>
<!--Primary Content -->
<div id="recipesContent">
<!--The ideal all recipes one page approach-->
<div *ngIf="main">
<div *ngFor="let item of items">
<p> {{item}} </p>
</div>
<app-component2 *ngIf="page"></app-component2>
</md-sidenav-container>
"@angular/animations": "^4.1.3",
"@angular/cli": "^1.2.0",
"@angular/common": "^4.1.3",
"@angular/compiler": "^4.1.3",
"@angular/compiler-cli": "^4.1.3",
"@angular/core": "^4.1.3",
"@angular/forms": "^4.1.3",
"@angular/http": "^4.1.3",
"@angular/material": "^2.0.0-beta.7",