Gbuomprisco / ngx-chips

Tag Input component for Angular
MIT License
899 stars 359 forks source link

Separator keys not working #90

Closed Gbuomprisco closed 7 years ago

jaysson commented 7 years ago

Any update?

Gbuomprisco commented 7 years ago

Hi @jaysson,

Sorry I'll probably be able to fix it in the weekend

Gbuomprisco commented 7 years ago

Hi @jaysson,

This should be fixed with the latest release :)

dimy4 commented 7 years ago

Hi trying to use your component ng2-tag-input, version 1.0.0 (compatible with Anguar2). We have a problem: separatorKeys do not work! Even we tried demo online (case with “space”) - and it did not work either. Do you have some hints for us? Thanks.

Gbuomprisco commented 7 years ago

Hi @dimy4,

can you post here some code? You may want to try separatorKeyCodes, the demo is outdated

dimy4 commented 7 years ago

Thanks for soon response. Here is the code (I put “…” for irellevant parts)

new.component.html

...
<tag-input [(ngModel)]="items" [separatorKeys]="[188]" name="tag"></tag-input>
...

new.component.ts

...
@Component({
  selector: 'app-home',
  templateUrl: './new.component.html'
})
export class NewComponent implements OnInit {
  items = [];
  constructor() { }

  ngOnInit() {}
}

app.module.ts

...
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import {routing} from './app.routing';

import { AppComponent } from './app.component';
import { NewComponent } from './new/new.component';
import { FooterComponent } from './footer/footer.component';
import { HeaderComponent } from './header/header.component';

import { TagInputModule } from 'ng2-tag-input';

@NgModule({
  declarations: [
    AppComponent,
    HeaderComponent,
    FooterComponent,
    NewComponent,
    …
  ],
  imports: [
    …
    TagInputModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
Gbuomprisco commented 7 years ago

try separatorKeyCodes, the demo is outdated

dimy4 commented 7 years ago

Thanks, that works! I advice you to update the README.md. First version which I used produced problems (cause I am using Angular2) and your newest version uses Angular4. README.md tells the version works with Angular >=2. As I saw current version not working it confused mit a lot. But now it is OK (I am using 1.0.0). Thanks again and good luck.