UNPKG

angular-ui-mention

Version:

Facebook-like @mentions for text inputs built around composability

1 lines 749 B
"use strict";angular.module("example",["ui.mention"]).run(["$rootScope",function($rootScope){$rootScope.post={message:"hi there @k"}}]).directive("mentionExample",function(){return{require:"uiMention",link:function($scope,$element,$attrs,uiMention){uiMention.findChoices=function(match,mentions){return choices.filter(function(choice){return!mentions.some(function(mention){return mention.id===choice.id})}).filter(function(choice){return~(choice.first+" "+choice.last).indexOf(match[1])})}}}});var choices=[{first:"bob",last:"barker",id:11123},{first:"kenny",last:"logins",id:"123ab-123"},{first:"kyle",last:"corn",id:"123"},{first:"steve",last:"rodriguez",id:"hi"},{first:"steve",last:"holt",id:"0-9"},{first:"megan",last:"burgerpants",id:"ab-"}];