-
Notifications
You must be signed in to change notification settings - Fork 540
Is it possible to invoke a scope method in the template? #486
Comments
Sorry for not replying sooner. That's not currently possible, but I've been thinking of implementing that feature in a future release. |
+1 |
So now you can use it as in my example or should I add $scope, like |
@beradrian You should add the |
To be clear
? |
@mbenford are you planning a new release including this fix soon, or should we directly use the commit hash for now? |
@theBull Yes, your markup is correct. Take a look at this working plunker. @vdsabev v3.1.1 has been released earlier today on all distribution channels. v3.1 had been released before, but don't use it because it's buggy. |
Thanks, @mbenford, it works beautifully! Something to note in our use case - we needed the event in the template of the Also, the autocomplete template click event bubbles up and the item gets added to the tags input list, unless the Example: <tags-input template-scope="this">
<auto-complete template="autocomplete-item-template"></auto-complete>
</tags-input>
<script type="text/ng-template" id="autocomplete-item-template">
<div>
<span ng-bind-html="$highlight($getDisplayText())"></span>
<i class="fa fa-fw fa-trash" ng-click="$scope.deleteAutocompleteItem(data, $event)"></i>
</div>
</script> $scope.deleteAutocompleteItem = function (data, $event) {
$event.stopPropagation(); // Prevent item from being added to the list
...
}; |
Would be nice to reference this here: http://mbenford.github.io/ngTagsInput/documentation/api#tagsInput or http://mbenford.github.io/ngTagsInput/documentation/guides/custom-templates |
Something like
The text was updated successfully, but these errors were encountered: