devlev1980
12/16/2018 - 4:01 PM

Previous Next Element in Array

	onSelect(event){
				console.log('selected student',event);
				this.currentStudent = event.item;

			
		}
		onPrevious(curentStudentId){
			console.log(curentStudentId)
		
			this.students.forEach((student,index) => {
				if(curentStudentId>0){
					this.previosStudent = this.students[curentStudentId-1];
					this.currentStudent = this.previosStudent;
				}
			});
		}
		onNext(curentStudentId){
			this.students.forEach((student,index) => {
				if(curentStudentId<this.students.length-1){
						this.nextStudent = this.students[curentStudentId+1];
						this.currentStudent = this.nextStudent;
				}
			});
		

		}

}