Html 如何访问angular的typescript文件中的formarray值

Html 如何访问angular的typescript文件中的formarray值,html,angular,typescript,Html,Angular,Typescript,我无法访问typescript文件中的表单数组值。我得到的是空白数组 这是我的html代码 <mat-form-field class="example-full-width" > <mat-label>Locations </mat-label> <mat-chip-list #chipList aria-label="Fruit sele

我无法访问typescript文件中的表单数组值。我得到的是空白数组 这是我的html代码

  <mat-form-field class="example-full-width" >
                    <mat-label>Locations </mat-label>
                    <mat-chip-list #chipList aria-label="Fruit selection">
                      <mat-chip
                        *ngFor="let loca of locationlist"
                        [selectable]="selectable"
                        [removable]="removable"
                        (removed)="remove(loca)">
                        {{loca.locationName}}
                        <mat-icon matChipRemove (click)="remove(loca)">cancel</mat-icon>
                      </mat-chip>
                      <input
                        placeholder="Locations"
                        #fruitInput
                        formArrayName="locationctrl"
                        [matAutocomplete]="auto"
                        [matChipInputFor]="chipList"
                        [matChipInputSeparatorKeyCodes]="separatorKeysCodes"
                        (matChipInputTokenEnd)="add($event)">
                    </mat-chip-list>
                    <mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)">
                      <mat-option *ngFor="let locc of locations " [value]="locc"> {{locc.locationName}}   </mat-option>
                    </mat-autocomplete>
                </mat-form-field>


位置
{{loca.locationName}
取消
{{locc.locationName}

我需要一个返回数组值的方法,但是我得到的是空白数组值

,以获得一个FraveStalk值或任何值,从HTML到.TS文件非常简单。你需要做的是, 在HTML文件中编写以下代码:-

 {{log(formarray)}} // or any value you want to log in console.
在.ts文件中,您可以编写以下函数:-

 log(value) {
   console.log(value);
 }

“我无法访问…在typescript文件中。”但您没有显示您的typescript文件。您能共享您的ts文件吗