@adriancarrid , . , , , . , :
import { ViewChild, Component, ViewEncapsulation } from '@angular/core';
import { NavController, Content } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'pages/home/home.html',
styles: [`
.scroll-content {
display: flex;
flex-direction: column;
}
.scroll-content ion-list {
margin-top: auto;
margin-bottom: 0;
}
`],
encapsulation: ViewEncapsulation.None
})
export class HomePage {
@ViewChild(Content) content: Content;
count = 4;
appName = 'Ionic App';
array = [
{ name: 'item-1' },
{ name: 'item-2' },
{ name: 'item-3' }
];
constructor(private navController: NavController) {
}
search() {
console.log('searching...');
}
add(number) {
let itemNumber = this.count;
this.array.push({ name: 'item-' + itemNumber });
this.scrollToBottom();
this.count += number;
}
scrollToBottom(){
let dimension = this.content.getContentDimensions();
this.content.scrollTo(0, dimension.scrollHeight);
}
}