Don
Don

Reputation: 1

How to call a function on tag remove in AngularJS ngInputTags

How can I call a function when I remove a tag? I tried various methods to do so but none worked. Can anyone one suggest help.

<tags-input ng-model="vm.studentObj.assigned_employees" display-property="name" >
</tags-input>
<p ng-bind="employee"></p>

Upvotes: 0

Views: 424

Answers (1)

geminiousgoel
geminiousgoel

Reputation: 319

Here is the Syntax:

<tags-input
  ng-model="{string}"
  [on-tag-removing="{expression}"]
  [on-tag-removed="{expression}"]
  [on-tag-clicked="{expression}"]>
</tags-input>

where: [onTagRemoving] can be described as an Expression that will be invoked before removing a tag. The tag is available as $tag. This method must return either a boolean value or a promise.

[onTagRemoved] is an Expression to evaluate upon removing an existing tag. The removed tag is available as $tag.

[onTagClicked] is an Expression to evaluate upon clicking an existing tag. The clicked tag is available as $tag.

In the end, now it's on you how you needs to fire an event.

Upvotes: 1

Related Questions