小编Pee*_*kay的帖子

Angular 中动态输入类型文本绑定

我有一个简单的应用程序,当在文本框中按下回车键时,它将文本框值添加到列表框中。这是我的 html 代码

<input type="text" value="{{ myText }}" (keypress)="keyEvent($event)"  /> 
<select multiple="multiple" >
  <option *ngFor="let item of itemsList">
    {{item}} 
  </option>
</select>
Run Code Online (Sandbox Code Playgroud)

这是我的打字稿组件代码

export class AppComponent {
  title = `hello world app !`;
  myText ='';
  itemsList = [];constructor() { 
  }

  ngOnInit() {
  }

  keyEvent(event)
  {
    if(event.keyCode === 13)
    {
      event.preventDefault(); // Otherwise the form will be submitted
      this.itemsList.push(this.myText);
    }
  }
Run Code Online (Sandbox Code Playgroud)

myText 值未更新。该值始终为空。

请帮助找出我在绑定 myText 时缺少的内容。

html angular

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

如何从 application.properties 设置 springfox.documentation.swagger.v2.path

我在基于 Java 的 REST API 中使用 Swagger2。已经从application.properties文件中设置了 API 的基本路径

server.contextPath=/myapi/v1/
Run Code Online (Sandbox Code Playgroud)

我可以在 localhost 中使用我的 Swagger UI 访问端点,如以下 URL 所示:

http://localhost:8080/myapi/v1/swagger-ui.html
Run Code Online (Sandbox Code Playgroud)

我的端点工作正常。但我无法从以下 URL 访问 JSON API 文档:

http://localhost:8080/myapi/v1/api-docs
Run Code Online (Sandbox Code Playgroud)

JSON API 文档已显示在:

http://localhost:8080/myapi/v1/v2/api-docs
Run Code Online (Sandbox Code Playgroud)

v2现在显示了一个额外的路径。我读过某些文章说这是因为 Swagger2 默认的 api-docs 路径,我们可以使用springfox.documentation.swagger.v2.path应用程序属性中的属性覆盖路径 。

如何将v2路径设置为http://localhost:8080/myapi/v1/api-docs ?通过application.properties? 我一直在尝试不同的路径,但没有得到正确的结果。

java swagger-2.0

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

标签 统计

angular ×1

html ×1

java ×1

swagger-2.0 ×1