Coder Social home page Coder Social logo

Comments (19)

shoudaos avatar shoudaos commented on June 11, 2024 1

while it is not ready you can use my workaround, if it is good for you:

On HTML:

<ng-select 
  #select_component 
  required  
  [ngClass]="{'selected': select_component.isValueSelected}"
  [items]="items"
  (selected)="select($event, select_component)">
</ng-select>

On JS:

select(event, select_component) {
    this.variable_name = event.id;
    select_component.isValueSelected = true;
  }

On scss:

ng-select[required] {
  .form-control {
    border-left: 5px solid $brand-danger;
  }

  &.selected {
    .form-control {
      border-left: 5px solid $brand-success;
    }
  }
}

from ng2-select.

nabeelbukhari avatar nabeelbukhari commented on June 11, 2024

Same issue here. Do we have any workaround for adding validation?

from ng2-select.

scottmas avatar scottmas commented on June 11, 2024

+1

from ng2-select.

 avatar commented on June 11, 2024

+1

from ng2-select.

Avien avatar Avien commented on June 11, 2024

+1

from ng2-select.

nanchao-p avatar nanchao-p commented on June 11, 2024

+1

from ng2-select.

hvqthong avatar hvqthong commented on June 11, 2024

+1

from ng2-select.

shoudaos avatar shoudaos commented on June 11, 2024

+1

from ng2-select.

shah-dhaval avatar shah-dhaval commented on June 11, 2024

+1

from ng2-select.

alaatek avatar alaatek commented on June 11, 2024

+1

from ng2-select.

swapsword avatar swapsword commented on June 11, 2024

+1

from ng2-select.

rodromart avatar rodromart commented on June 11, 2024

+1

from ng2-select.

thrashard avatar thrashard commented on June 11, 2024

+1

from ng2-select.

GuillaumeDK57 avatar GuillaumeDK57 commented on June 11, 2024

+1

from ng2-select.

m3hari avatar m3hari commented on June 11, 2024

+1

from ng2-select.

m3hari avatar m3hari commented on June 11, 2024

This is very critical feature.

from ng2-select.

shoebsd31 avatar shoebsd31 commented on June 11, 2024

+1

from ng2-select.

rakesh2409 avatar rakesh2409 commented on June 11, 2024

@shoudaos Your solution works however I have enhanced further to work like proper form validation:

//declare disabledSave variable in module.ts or JS
disabledSave: boolean = false;

select(event, select_component) {
this.variable_name = event.id;
if(event) {
this.disabledSave = false;
} else {
this.disabledSave = true;
}
select_component.isValueSelected = true;
}

In HTML:
<button type="submit" [disabled]="disabledSave" class="btn btn-success box-shadow">Save

from ng2-select.

optimistex avatar optimistex commented on June 11, 2024

New life the component is there: https://github.com/optimistex/ng2-select-ex

from ng2-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.