File tree Expand file tree Collapse file tree
src/app/shared/components/tags-input Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 (click) ="!readonly() && onContainerClick() "
99 (keydown) ="!readonly() && onContainerKeydown($event) "
1010 >
11- @for (tag of localTags(); track $index ) {
11+ @for (tag of localTags(); track tag ) {
1212 < p-chip [label] ="tag " [removable] ="!readonly() " (onRemove) ="removeTag($index) " class ="p-chip-inline " />
1313 }
1414
Original file line number Diff line number Diff line change @@ -32,17 +32,12 @@ export class TagsInputComponent {
3232 inputElement = viewChild < ElementRef < HTMLInputElement > > ( 'tagInput' ) ;
3333
3434 localTags = signal < string [ ] > ( [ ] ) ;
35- private isLocalUpdate = false ;
3635
3736 constructor ( ) {
3837 effect ( ( ) => {
3938 const incoming = this . tags ( ) ;
4039
41- if ( ! this . isLocalUpdate ) {
42- this . localTags . set ( [ ...incoming ] ) ;
43- }
44-
45- this . isLocalUpdate = false ;
40+ this . localTags . set ( [ ...incoming ] ) ;
4641 } ) ;
4742 }
4843
@@ -92,8 +87,6 @@ export class TagsInputComponent {
9287 const updatedTags = [ ...currentTags , normalizedValue ] ;
9388
9489 this . localTags . set ( updatedTags ) ;
95- this . isLocalUpdate = true ;
96-
9790 this . tagsChanged . emit ( updatedTags ) ;
9891 }
9992 }
@@ -105,8 +98,6 @@ export class TagsInputComponent {
10598 const updatedTags = currentTags . filter ( ( _ , i ) => i !== index ) ;
10699
107100 this . localTags . set ( updatedTags ) ;
108- this . isLocalUpdate = true ;
109-
110101 this . tagsChanged . emit ( updatedTags ) ;
111102 }
112103}
You can’t perform that action at this time.
0 commit comments