Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds functionality to make ng2-select compatible with form-controls #881

Merged
merged 5 commits into from
Nov 22, 2017

Conversation

sonukapoor
Copy link
Contributor

@sonukapoor sonukapoor commented Sep 6, 2017

Please review attached PR. It allows you to use the ng2-select component with ngModel.

Simple usage:

Add the following attributes:

name is the name of your control.
[(ngModel)] should be set to your selected items. It's should be the same as [active].

`<form #form="ngForm">
<ng-select required
name="mySelect"
#mySelect="ngModel"
[(ngModel)]="selectedItems"
[active]="selectedItems"
[items]="newItems">

`

Is Form Valid: {{ form.valid }}

Is Control Valid: {{ mySelect.valid }}

Note: I have tested this only with template forms.

Feedback is appreciated.

@codecov
Copy link

codecov bot commented Sep 6, 2017

Codecov Report

Merging #881 into development will decrease coverage by 6.95%.
The diff coverage is 55.81%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #881      +/-   ##
===============================================
- Coverage        37.33%   30.37%   -6.96%     
===============================================
  Files               11       11              
  Lines              450      451       +1     
  Branches            73       76       +3     
===============================================
- Hits               168      137      -31     
- Misses             282      313      +31     
- Partials             0        1       +1
Impacted Files Coverage Δ
src/select/select.ts 19.04% <55.81%> (-8.67%) ⬇️
src/select/select-pipes.ts 31.57% <0%> (-3.43%) ⬇️
src/select/off-click.ts 70% <0%> (-2.73%) ⬇️
src/select/select.module.ts 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3afaf63...d76c726. Read the comment docs.

@sonukapoor
Copy link
Contributor Author

@valorkin Any chance to get this merged?

@eamonn
Copy link

eamonn commented Oct 25, 2017

@sonukapoor good work. Any chance you can merge this @valorkin ???

@valorkin
Copy link
Member

thanks for contributing!
please remove package-lock

I am addressing this PR to ngx team, we will try to publish it soon

@sonukapoor
Copy link
Contributor Author

sonukapoor commented Oct 25, 2017 via email

@sonukapoor
Copy link
Contributor Author

@valorkin done. I also reverted the other files. Please also note that my vs code formatted the file with proper spaces etc. and when reviewing you should ignore the white spaces:

https://github.com/valor-software/ng2-select/pull/881/files?w=1

@mohamedfathii
Copy link

mohamedfathii commented Nov 21, 2017

when this PR will be merged ?

@sonukapoor
Copy link
Contributor Author

I have a separate fork with the compiled version of the ng2-select using this PR that is available for anybody that wants to use it:

https://github.com/sonukapoor/ng2-select-forms

@IlyaSurmay
Copy link
Contributor

I'm updating dependencies right now so we'll be able to test it soon, then it will be merged.

@valorkin valorkin merged commit 201c6e2 into valor-software:development Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants