question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NbAutocomplete - Problem with disabling autocomplete input using FormControl

See original GitHub issue

Issue type

I’m submitting a … (check one with “x”)

  • bug report
  • feature request

Issue description

Current behavior: Cannot apply disabled attribute on input using FormControl

I try to disable form control using form.disable() or inputCtrl.disable() and the input is still enabled. It looks like directive doesn’t take it into account while setting value and other attributes.

I also checked this behavior using nebular playground from repository and I still couldn’t set disabled attribute.

Expected behavior: When setting ‘disabled’ status on FormControl or Reactive Form autocomplete input should be disabled.

Steps to reproduce:

  1. Use reactive form autocomplete in template basing docs
  2. Set FormControl initial status to field: { value: '', disabled: true } or use formControl.disable() or form.disable()

Related code:

// This doesn't work
this.inputFormControl = new FormControl({ value: '', disabled: true });

// doesn't work either
this.inputFormControl.disable();

// this returns `true` - model has information about control `disabled` state
console.log(this.inputFormControl.disabled)

Other information:

npm, node, OS, Browser

Node: v12.16.1
npm: 6.13.4
OS: Ubuntu 18.04.2 LTS
Browser: Chrome

Angular, Nebular

    "@angular/animations": "~9.1.0",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@nebular/auth": "^5.0.0",
    "@nebular/bootstrap": "^5.0.0",
    "@nebular/date-fns": "^5.0.0",
    "@nebular/eva-icons": "^5.0.0",
    "@nebular/theme": "^5.0.0",

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
kostetskyromacommented, Jun 16, 2020

+1

0reactions
ygggcommented, Aug 16, 2021

Fixed via #2555, included in 7.0.0+

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Material's mat-autocomplete input is not getting ...
You should use formControl to set it, something like: this.formGroupName.controls['myControl'].disable().
Read more >
Autocomplete | Angular Material
The autocomplete is a normal text input enhanced by a panel of suggested options. ... Let's assume you're using the formControl directive from...
Read more >
can't bind to 'matautocomplete' since it isn't a known property ...
Angular 8 mat-autocomplete ERROR - 'matAutocomplete' since it isn't a known property ... You can use Input to pass true or false then...
Read more >
Turn Off AutoComplete Input Angular - Code Handbook
How to turn autocomplete off in Angular forms? ... <input type="number" formControlName="age" class="form-control" placeholder="Age"> </div> ...
Read more >
Angular Material as a base for reusable components - Medium
But …. what if we have been using it wrong ? I… ... https://material.angular.io/components/input/overview. HTML for Angular Material inputs
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found