fix: clear page fragment when scroll to the beginning

This commit is contained in:
Roman Hotsiy 2017-02-28 23:46:43 +02:00
parent 7b19417497
commit 929740ab28
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 6 additions and 3 deletions

View File

@ -28,7 +28,7 @@ export class Hash {
} }
update(hash: string|null) { update(hash: string|null) {
if (!hash) return; if (hash == undefined) return;
this.noEmit = true; this.noEmit = true;
window.location.hash = hash; window.location.hash = hash;
setTimeout(() => { setTimeout(() => {

View File

@ -208,7 +208,10 @@ export class MenuService {
this.deactivate(this.activeIdx); this.deactivate(this.activeIdx);
this.activeIdx = idx; this.activeIdx = idx;
if (idx < 0) return; if (idx < 0) {
this.hash.update('');
return;
}
item.active = true; item.active = true;
@ -409,7 +412,7 @@ export class MenuService {
checkAllTagsUsedInGroups() { checkAllTagsUsedInGroups() {
for (let tag of Object.keys(this._tagsWithMethods)) { for (let tag of Object.keys(this._tagsWithMethods)) {
if (!this._tagsWithMethods[tag].used) { if (!this._tagsWithMethods[tag].used) {
WarningsService.warn(`Tag "${tag}" is not added to any group`) WarningsService.warn(`Tag "${tag}" is not added to any group`);
} }
} }
} }