小编cac*_*000的帖子

Angular 5+ Material Autocomplete 位置错误

我正在尝试执行angular material website 中提供的示例以进行自动完成,当我在应用程序中实现它时,选项出现在其他地方而不是在输入下,如图所示在此处输入图片说明

我目前在html 文件中有以下代码

<form class="example-form">
    <mat-form-field class="example-full-width">
      <input matInput placeholder="State" aria-label="State" 
       [matAutocomplete]="auto" [formControl]="stateCtrl">
      <mat-autocomplete #auto="matAutocomplete">
        <mat-option *ngFor="let state of filteredStates | async" 
          [value]="state.name">
          <img class="example-option-img" aria-hidden [src]="state.flag" 
            height="25">
          <span>{{state.name}}</span> |
          <small>Population: {{state.population}}</small>
        </mat-option>
      </mat-autocomplete>
    </mat-form-field>
</form>
Run Code Online (Sandbox Code Playgroud)

这就是我在component.ts 文件中的内容

import { FormControl } from '@angular/forms';
import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators';

  stateCtrl = new FormControl();
  filteredStates: Observable < State[] >;

  states: State[] = [
    {
      name: …
Run Code Online (Sandbox Code Playgroud)

angular-material2 angular

2
推荐指数
1
解决办法
1574
查看次数

使用 AWS API 删除 DynamoDB 条目

我正在学习 AWS API Gateway 来管理云中的 api,而不是通过express.js。我使用以下集成请求在资源下创建了方法DELETE 。

整合请求

Integration Type: AWS Service
AWS Region: us-east-1
AWS Service: DynamoDB
HTTP method: DELETE
Action: deleteItem
Execution role: XXXXXX
Content Handling: Passthrough
Run Code Online (Sandbox Code Playgroud)

执行角色正在发挥作用,因为我可以读取/写入 DynamoDB。身体测绘模板,其内容Content-Type: application/json如下:

{ 
    "TableName": "comments",
    "Key": {
        "commentId": {
            "S": "$context.requestId"
            },
        "pageId": {
            "S": "$input.path('$.pageId')"
            },
        "userName": {
            "S": "$input.path('$.userName')"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试使用请求正文运行测试时,如下所示:

{
  "pageId":   "breaking-news-story-01-18-2016",
  "userName": "cacevedo"
}
Run Code Online (Sandbox Code Playgroud)

我得到以下信息:

Request: /comments
Status: 200
Latency: 80 ms
Response Body

Response …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-api-gateway

0
推荐指数
1
解决办法
1761
查看次数