ng2-select icon indicating copy to clipboard operation
ng2-select copied to clipboard

Add required attribute

Open ghost opened this issue 9 years ago • 6 comments

Please add required attribute also. Its hard to add manually.

ghost avatar Dec 27 '16 11:12 ghost

Can you please provide code how you added manual validation on this?

skgyan avatar Jan 06 '17 11:01 skgyan

yeah,, I am adding dynamic styles using [ngClass]

1st step: you have to add this to your ng-select elemet => [ngClass]="{'ng-select-required':myModel.myItemID==0 }"

2nd step: you have to create style like this =>

.ng-select-required > div > div > span { border-left:solid 3px red !important; }

note: since these people have not exposed any property for required attribute of the input field,so we have to tweak it little bit, what I have done above is adding dynamic style to the 'span'

ghost avatar Jan 13 '17 13:01 ghost

Thanks a lot for the workaround Vsanat, it helped me out :) But I think the required class definition should be .ng-select-required div > div > span { border-left:solid 3px red !important; } There was an extra ng-select I think.

azeyad avatar Feb 26 '17 20:02 azeyad

Yeah you are right.. removed that :)

ghost avatar Mar 23 '17 08:03 ghost

thanks for the solutions!! It was great for me, but could you post the same solution for multiple ng2-select option?

rodromart avatar Apr 20 '17 20:04 rodromart

Hi vsanat, I am facing same issue, can you share HTML tag. am trying to implement your code but somehow it's not working. Thanks for your help.

amitvermaknw avatar May 11 '17 03:05 amitvermaknw