Ui-select replacement in Angular2

We are migrating the existing angular1 project to angular2 and want to replace the existing ui-select component.

I have googled but could not find the ui-select version for angular2.

Has anyone found a better alternative?

+5
source share
5 answers

ng2-select will do some of these. But it does not yet support dynamic data binding.

In fact, for almost any of the third-party plugins implemented for angular, it is not implemented for angular2.

+1
source

For components designed specifically for Angular 2, see Kendo's DropDowns package for Angular 2. It is still in beta and feedback is welcome.

0
source

If someone is redirected to ng2 and needs to run a hybrid application (working both ng1 and ng2 - now called AngularJS and Angular respectively), you can wrap ng1 UI widgets that were not created using ng1 components (for example, select ui ) for use in ng2 component templates. We did it successfully using ui-select, and it works great. In particular, look at the @Directive annotation @Directive .

 import {Directive, ElementRef, Injector, Input} from '@angular/core'; import {UpgradeComponent} from '@angular/upgrade/static'; import {module, IComponentOptions} from 'angular'; class UiSelectComponent implements IComponentOptions { public bindings: any = { items: '<', model: '<', modelProperty: '@', placeholder: '@', renderProperty: '@', selectProperty: '@' }; public template = ` <ui-select ng-model="$ctrl.model[$ctrl.modelProperty]" class="form-control input-sm" required> <ui-select-match placeholder="{{$ctrl.placeholder}}">{{$select.selected[$ctrl.renderProperty]}}</ui-select-match> <ui-select-choices repeat="item[$ctrl.selectProperty] as item in $ctrl.items | filter: $select.search"> {{item[$ctrl.renderProperty]}} </ui-select-choices> </ui-select> `; } const selector = 'uiSelectWrapper'; export const UI_SELECT_COMPONENT = 'spinnaker.core.widget.uiSelect.component'; module(UI_SELECT_COMPONENT, []).component(selector, new UiSelectComponent()); @Directive({ selector: 'ui-select-wrapper' }) export class UiSelectComponentDirective extends UpgradeComponent { @Input() public items: any[]; @Input() public model: any; @Input() public modelProperty: string; @Input() public placeholder: string; @Input() public renderProperty: string; @Input() public selectProperty: string; constructor(elementRef: ElementRef, injector: Injector) { super(selector, elementRef, injector); } } 
0
source

You saw ngx-select-ex fork ng2-select . ngx-select-ex has one choice, multi-selection, selection, blur, e.g. select2. ngx-select-ex demo

-1
source

All Articles