Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

scoll a div to bottom in angular

import {..., AfterViewChecked, ElementRef, ViewChild, OnInit} from 'angular2/core'
@Component({
    ...
})
export class ChannelComponent implements OnInit, AfterViewChecked {
    @ViewChild('scrollMe') private myScrollContainer: ElementRef;

    ngOnInit() { 
        this.scrollToBottom();
    }

    ngAfterViewChecked() {        
        this.scrollToBottom();        
    } 

    scrollToBottom(): void {
        try {
            this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
        } catch(err) { }                 
    }
}
Comment

scroll bottom of page or div angular

<div #myscroll> apply id to overflow div  </div>
@ViewChild('myscrool') myscrool: ElementRef;
ngAfterViewChecked(){
    this.myscrool.nativeElement.scrollTop = this.myscrool.nativeElement.scrollHeight;
  }
Comment

PREVIOUS NEXT
Code Example
Javascript :: country code regex 
Javascript :: jquery checkbox set checked 
Javascript :: react native text area form 
Javascript :: remove all from array that matches 
Javascript :: javascript replace part of string 
Javascript :: react font awesome delete icon 
Javascript :: vibrate javascript 
Javascript :: horizontal divider react native 
Javascript :: react import font awesome 
Javascript :: python json dump to file 
Javascript :: align left text in reactstrap 
Javascript :: session storage 
Javascript :: choose jsp 
Javascript :: Node.js: printing to console without a trailing newline 
Javascript :: javascript get age 
Javascript :: play an audio at a specific volume in javascript 
Javascript :: jquery avoid enter submit 
Javascript :: js shuffle array 
Javascript :: javascript image xss 
Javascript :: react-native-paper password input 
Javascript :: npm font awesome vue 
Javascript :: rimraf node_modules 
Javascript :: js appendchild wait for callback 
Javascript :: passport.initialize() middleware not in use 
Javascript :: regx get only domain name from url 
Javascript :: nodejs copy to clipboard 
Javascript :: npm react-dom 
Javascript :: sequelize pagination postgres 
Javascript :: sanitise string js 
Javascript :: search in a table jquery 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =