[Layout] NbLayoutScrollService code example request
- 主要言語
- TypeScript
- スター
- 8.1k
- フォーク
- 1.5k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### Issue type
**I'm submitting a ...** (check one with "x")
* [x] feature request
### Issue description
**Current behavior:**
NbLayoutScrollService documentation is really dry.
**Expected behavior:**
Some code examples would be much appreciated.
**Steps to reproduce:**
- open https://akveo.github.io/nebular/docs/services/layoutscrollservice#nblayoutscrollservice
**Related code:**
I attempted to figure out how it work, but for a newbie it's a bit too much without a guidance. Here is what i thought should work.
```
ngAfterViewChecked(): void {
function getOffset(el) {
const rect = el.getBoundingClientRect();
return {
left: rect.left + window.scrollX,
top: rect.top + window.scrollY
};
}
try {
const pageElement = document.getElementById(this.fragment);
if (pageElement) {
this.scrollService.scrollTo(getOffset(pageElement).left, getOffset(pageElement).top);
this.fragment = '';
}
} catch (e) { }
}
```
**Angular, Nebular**
```
"@angular/core": "6.0.3"
"@nebular/auth": "^2.0.0-rc.10"
"@nebular/security": "^2.0.0-rc.10"
"@nebular/theme": "^2.0.0-rc.10"
```
コントリビューションガイド
評価
この issue はまだ評価されていません。