markdown Angular - 防止在Android中推送页脚

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Angular - 防止在Android中推送页脚相关的知识,希望对你有一定的参考价值。

# Angular - Prevent  Footer Being Pushed Up Android

[SOURCE](https://stackoverflow.com/a/35527852/1602807), [SOURCE](https://stackoverflow.com/a/45451974/1602807), 
[SOURCE](https://stackoverflow.com/a/38559158/1602807)

Footer with `fixed-bottom` will be pushed up when keyboard show in Android devices as the screen will be resized. Thus we actively listen for the `resize` event and hide the footer accordingly.

```html
<app-footer *ngIf="shouldShowFooter"></app-footer>
```

```typescript
shouldShowFooter = true;

@HostListener('window:resize', ['$event'])
onResize(event) {
    if (AgentUtil.isAndroidDevice()) {
        const height = event.target.innerHeight;
        // when keyboard shows on Android device, screen will be resize
        // thus we ned to listen for the resize event and hide the footer
        // to prevent footer being pushed up.
        this.shouldShowFooter = height >= 480;
    }
}

// For comprehensive list of OS see
// https://stackoverflow.com/a/38559158/1602807
export class AgentUtil {
    static isIOSDevice(): boolean {
        return /iPhone|iPad|iPod/i.test(navigator.userAgent);
    }
    static isAndroidDevice(): boolean {
        return /Android/i.test(navigator.userAgent);
    }
}
```

以上是关于markdown Angular - 防止在Android中推送页脚的主要内容,如果未能解决你的问题,请参考以下文章

markdown 在Cloud9上运行Angular 2和Angular 4

markdown JHipster - 在Angular上导入模块

markdown Angular - 在输入字段中监听变化

markdown PLDT HOME FIBR AN5506-04-FA RP2616高级设置

angular中安装@angular/cdk时遇到的错误——node_modules/@angular/cdk/table/table.d.ts:277:9 - error TS1086: An ac

a brief introduction to an interesting language ---Markdown(转载)