How to add Validation pattern not to allow only space in input Angular2?

前端 未结 4 1603
不知归路
不知归路 2021-01-03 09:02

I used formBuilder in Angular2 and want to add validation pattern for not to allow \"only spaces\" in input.

4条回答
  •  [愿得一人]
    2021-01-03 09:38

    try this, it will return false while sapce key press :

    @Component({
      selector: 'my-app',
      template: `
        
    `, providers: [myService] })

    visit for more Events :

    https://developer.mozilla.org/en-US/docs/Web/Events

提交回复
热议问题