Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 7, 2020. It is now read-only.

Commit 18f8f5e

Browse files
author
Dean Sofer
committed
v0.0.3
✅ Renamed directive to `ui-mention` ✅ Knocked the README up a notch.
1 parent c3966ad commit 18f8f5e

File tree

6 files changed

+68
-21
lines changed

6 files changed

+68
-21
lines changed

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,64 @@ Facebook-like @mentions for text inputs built around composability
88
0. `bower install`
99
0. `gulp [watch]`
1010
0. Compiling the example code: `gulp example [watch]`
11+
12+
## Amazing Features!
13+
14+
Find things!:
15+
```
16+
mention.findChoices = function(match) {
17+
// Matches items from search query
18+
return [/* choices */].filter( choice => ~this.label(choice).indexOf(match[1]) );
19+
}
20+
```
21+
22+
Type too damn fast? Throttle that bitch:
23+
```
24+
mention.findChoices = _.throttle(function(match) {
25+
return [/* choices */];
26+
}, 300);
27+
```
28+
29+
Hate redundancy? De-dupe that shiz:
30+
```
31+
mention.findChoices = function(match, mentions) {
32+
return [ /* choices */ ].filter( choice => !mentions.some( mention => mention.id === choice.id ) )
33+
};
34+
```
35+
36+
Use the awesome power of the internet:
37+
```
38+
mention.findChoices = function(match) {
39+
return $http.get('/users', { params: { q: match[1] } })
40+
.then( response => response.data );
41+
}
42+
```
43+
44+
Your servers are slow? Bitch please.
45+
```
46+
mention.findChoices = function(match) {
47+
mention.loading = true;
48+
return $http.get(...)
49+
.then( response => {
50+
mention.loading = false;
51+
return response.data;
52+
});
53+
}
54+
```
55+
56+
Dropdown that list like it's hot:
57+
```
58+
<ul ng-if="$mention.choices.length" class="dropdown">
59+
<li ng-repeat="choice in choice" ng-click="$mention.select(choice)">
60+
{{::choice.name}}
61+
</li>
62+
</ul>
63+
```
64+
65+
SPINNIES!
66+
```
67+
<ul ng-if="$mention.choices.length" class="dropdown">
68+
<li ng-show="$mention.loading">Hacking the gibson...</li>
69+
<li ng-repeat=...>...</li>
70+
</ul>
71+
```

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-mention",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"homepage": "https://github.com/angular-ui/ui-mention",
55
"authors": [
66
"AngularUI Team"

dist/mention.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
44

5-
angular.module('ui.mention', []).directive('mention', function ($q, $timeout) {
5+
angular.module('ui.mention', []).directive('uiMention', function ($q, $timeout) {
66
return {
77
require: ['ngModel', 'mention'],
88
controllerAs: '$mention',
@@ -246,17 +246,7 @@ angular.module('ui.mention', []).directive('mention', function ($q, $timeout) {
246246
* @return {array[choice]|Promise} The list of possible choices
247247
*/
248248
this.findChoices = function (match, mentions) {
249-
return []
250-
// Remove items that are already mentioned
251-
.filter(function (choice) {
252-
return !mentions.some(function (mention) {
253-
return mention.id === choice.id;
254-
});
255-
})
256-
// Matches items from search query
257-
.filter(function (choice) {
258-
return ~(choice.first + ' ' + choice.last).indexOf(match[1]);
259-
});
249+
return [];
260250
};
261251

262252
/**

dist/mention.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-mention",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Facebook-like @mentions for text inputs built around composability",
55
"main": "src/mention.js",
66
"scripts": {

src/mention.es6.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
angular.module('ui.mention', [])
2-
.directive('mention', function($q, $timeout){
2+
.directive('uiMention', function($q, $timeout){
33
return {
44
require: ['ngModel', 'mention'],
55
controllerAs: '$mention',
@@ -226,11 +226,7 @@ angular.module('ui.mention', [])
226226
* @return {array[choice]|Promise} The list of possible choices
227227
*/
228228
this.findChoices = function(match, mentions) {
229-
return []
230-
// Remove items that are already mentioned
231-
.filter( choice => !mentions.some( mention => mention.id === choice.id ) )
232-
// Matches items from search query
233-
.filter( choice => ~`${choice.first} ${choice.last}`.indexOf(match[1]) );
229+
return [];
234230
};
235231

236232
/**

0 commit comments

Comments
 (0)