ngx-chips: it's not possible to add a second tag from autocompleteItems
up vote
1
down vote
favorite
I'm using ngx-chips with autocompleteItems for tags input, but after adding the first tag, the dropdown is not appearing anymore and also there is no error in the console.
HTML
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
when adding the first tag, the dropdown appears

but when trying to add a second one, the dropdown does not appear

Stackblitz
angular typescript ngx-chips
add a comment |
up vote
1
down vote
favorite
I'm using ngx-chips with autocompleteItems for tags input, but after adding the first tag, the dropdown is not appearing anymore and also there is no error in the console.
HTML
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
when adding the first tag, the dropdown appears

but when trying to add a second one, the dropdown does not appear

Stackblitz
angular typescript ngx-chips
Can you replicate this issue in stackblitz ?
– Sunil Singh
Nov 11 at 3:06
@SunilSingh I added a link to stackblitz
– Paul
Nov 11 at 9:51
Added the answer .
– Sunil Singh
Nov 11 at 10:16
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm using ngx-chips with autocompleteItems for tags input, but after adding the first tag, the dropdown is not appearing anymore and also there is no error in the console.
HTML
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
when adding the first tag, the dropdown appears

but when trying to add a second one, the dropdown does not appear

Stackblitz
angular typescript ngx-chips
I'm using ngx-chips with autocompleteItems for tags input, but after adding the first tag, the dropdown is not appearing anymore and also there is no error in the console.
HTML
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
when adding the first tag, the dropdown appears

but when trying to add a second one, the dropdown does not appear

Stackblitz
angular typescript ngx-chips
angular typescript ngx-chips
edited Nov 11 at 9:51
asked Nov 11 at 1:49
Paul
7732935
7732935
Can you replicate this issue in stackblitz ?
– Sunil Singh
Nov 11 at 3:06
@SunilSingh I added a link to stackblitz
– Paul
Nov 11 at 9:51
Added the answer .
– Sunil Singh
Nov 11 at 10:16
add a comment |
Can you replicate this issue in stackblitz ?
– Sunil Singh
Nov 11 at 3:06
@SunilSingh I added a link to stackblitz
– Paul
Nov 11 at 9:51
Added the answer .
– Sunil Singh
Nov 11 at 10:16
Can you replicate this issue in stackblitz ?
– Sunil Singh
Nov 11 at 3:06
Can you replicate this issue in stackblitz ?
– Sunil Singh
Nov 11 at 3:06
@SunilSingh I added a link to stackblitz
– Paul
Nov 11 at 9:51
@SunilSingh I added a link to stackblitz
– Paul
Nov 11 at 9:51
Added the answer .
– Sunil Singh
Nov 11 at 10:16
Added the answer .
– Sunil Singh
Nov 11 at 10:16
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Since you are using the complex object as options you should use identifyBy through which ngx-chips will compare the selected items with provided options.
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[identifyBy]="'name'" <!-- use any property of object -->
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
Working copy is here - https://stackblitz.com/edit/angular-icraz4
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Since you are using the complex object as options you should use identifyBy through which ngx-chips will compare the selected items with provided options.
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[identifyBy]="'name'" <!-- use any property of object -->
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
Working copy is here - https://stackblitz.com/edit/angular-icraz4
add a comment |
up vote
1
down vote
accepted
Since you are using the complex object as options you should use identifyBy through which ngx-chips will compare the selected items with provided options.
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[identifyBy]="'name'" <!-- use any property of object -->
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
Working copy is here - https://stackblitz.com/edit/angular-icraz4
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Since you are using the complex object as options you should use identifyBy through which ngx-chips will compare the selected items with provided options.
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[identifyBy]="'name'" <!-- use any property of object -->
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
Working copy is here - https://stackblitz.com/edit/angular-icraz4
Since you are using the complex object as options you should use identifyBy through which ngx-chips will compare the selected items with provided options.
<tag-input
[ngModel]="columnsToIgnore"
[ngModelOptions]="{standalone: true}"
[placeholder]="'Enter variables to ignore'"
[secondaryPlaceholder]="'Enter variables to ignore'"
[onlyFromAutocomplete]="true"
(onAdd)="addIgnoreColumn($event)"
(onRemove)="removeIgnoreColumn($event)"
theme='bootstrap'>
<tag-input-dropdown
[autocompleteItems]="selectedDataset.schema.columns"
[displayBy]="'name'"
[identifyBy]="'name'" <!-- use any property of object -->
[focusFirstElement]="true">
<ng-template let-item="item" let-index="index">
{{ item.name }} : {{ item.type }}
</ng-template>
</tag-input-dropdown>
</tag-input>
Working copy is here - https://stackblitz.com/edit/angular-icraz4
answered Nov 11 at 10:15
Sunil Singh
5,5571625
5,5571625
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245163%2fngx-chips-its-not-possible-to-add-a-second-tag-from-autocompleteitems%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you replicate this issue in stackblitz ?
– Sunil Singh
Nov 11 at 3:06
@SunilSingh I added a link to stackblitz
– Paul
Nov 11 at 9:51
Added the answer .
– Sunil Singh
Nov 11 at 10:16