Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 设置水平滚动位置-3_Angular_Ionic Framework_Ionic2_Ionic3 - Fatal编程技术网

Angular 设置水平滚动位置-3

Angular 设置水平滚动位置-3,angular,ionic-framework,ionic2,ionic3,Angular,Ionic Framework,Ionic2,Ionic3,我正在尝试更改ion scroll元素的滚动位置,但没有获得。。这就是我尝试过的: ts import { Component, ViewChild, ElementRef } from "@angular/core"; @ViewChild("scroller", { read: ElementRef }) private scroller: ElementRef; this.scroller.nativeElement.style.background = "blue"; h

我正在尝试更改
ion scroll
元素的滚动位置,但没有获得。。这就是我尝试过的:

ts

import { Component, ViewChild, ElementRef } from "@angular/core";

 @ViewChild("scroller", { read: ElementRef })
  private scroller: ElementRef;
  this.scroller.nativeElement.style.background = "blue";
html

 <ion-scroll #scroller scrollX="true" style="height: 21px; white-space: nowrap">
  <div>... </div>
 </ion-scroll>
这不起作用

  this.scroller.nativeElement.scrollLeft = this.scroller.nativeElement.scrollWidth;

你试过这个问题的答案吗?