valor-software / ng2-select

Angular based replacement for select boxes
http://valor-software.github.io/ng2-select/
MIT License
675 stars 585 forks source link

self.context.typed is not a function error in Angular 2.4.0 #655

Open blubberbo opened 7 years ago

blubberbo commented 7 years ago

Hi, copy and pasted the code from the demo:

<ng-select [allowClear]="true"
           [items]="items"
           [disabled]="disabled"
           (data)="refreshValue($event)"
           (selected)="selected($event)"
           (removed)="removed($event)"
           (typed)="typed($event)"
           placeholder="No city selected">
</ng-select>

and

    public items: Array<string> = ['Amsterdam', 'Antwerp', 'Athens', 'Barcelona',
        'Berlin', 'Birmingham', 'Bradford', 'Bremen', 'Brussels', 'Bucharest',
        'Budapest', 'Cologne', 'Copenhagen', 'Dortmund', 'Dresden', 'Dublin',
        'Düsseldorf', 'Essen', 'Frankfurt', 'Genoa', 'Glasgow', 'Gothenburg',
        'Hamburg', 'Hannover', 'Helsinki', 'Kraków', 'Leeds', 'Leipzig', 'Lisbon',
        'London', 'Madrid', 'Manchester', 'Marseille', 'Milan', 'Munich', 'Málaga',
        'Naples', 'Palermo', 'Paris', 'Poznań', 'Prague', 'Riga', 'Rome',
        'Rotterdam', 'Seville', 'Sheffield', 'Sofia', 'Stockholm', 'Stuttgart',
        'The Hague', 'Turin', 'Valencia', 'Vienna', 'Vilnius', 'Warsaw', 'Wrocław',
        'Zagreb', 'Zaragoza', 'Łódź'];

    private value: any = {};
    private _disabledV: string = '0';
    private disabled: boolean = false;

with the following import in my module: import { SelectModule } from 'ng2-select';

and the following in my systemjs map: 'ng2-select': 'npm:ng2-select', and packges: 'ng2-select': {defaultExtension: 'js', main:'index.js'},

and my error is the following:

TypeError: self.context.typed is not a function
    at CompiledTemplate.proxyViewClass.View_CreateCardComponent0.handleEvent_1 (/CreateCardModule/CreateCardComponent/component.ngfactory.js:871)
    at CompiledTemplate.proxyViewClass.eval (core.umd.js:12399)
    at SafeSubscriber.schedulerFn [as _next] (core.umd.js:3701)
    at SafeSubscriber.__tryOrUnsub (Subscriber.ts:238)
    at SafeSubscriber.next (Subscriber.ts:190)
    at Subscriber._next (Subscriber.ts:135)
    at Subscriber.next (Subscriber.ts:95)
    at EventEmitter.Subject.next (Subject.ts:61)
    at SelectComponent.doEvent (select.js:209)
    at SelectComponent.inputEvent (select.js:181)
    at View_SelectComponent6.handleEvent_0 (/SelectModule/SelectComponent/component.ngfactory.js:311)
    at View_SelectComponent6.eval (core.umd.js:12399)
    at HTMLInputElement.eval (platform-browser.umd.js:3224)
    at ZoneDelegate.invokeTask (zone.js:275)
    at Object.onInvokeTask (core.umd.js:3971)

is there any reason it is related to the Angular 2 version I am using or that I am using Bootstrap 4 instead of 3?

blubberbo commented 7 years ago

not sure if it is the same issue, but I noticed on plunkr that it does not work with the bootstrap4 css loaded:

https://plnkr.co/edit/RunHyrmH2DThoqpItmR3?p=preview

optimistex commented 6 years ago

Work by supporting Bootstrap 4 was planned: https://github.com/optimistex/ng2-select-ex/issues/5