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 a369fb6

Browse files
author
Dean Sofer
committed
v0.0.6
- autogrow fix during programmatic changes - named controllers more concisely (sorry @kasperlewau)
1 parent d7203c8 commit a369fb6

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ You have to build the HTML yourself:
4646
<div class="ui-mention-container">
4747

4848
<textarea ng-model="data" ui-mention my-mention></textarea>
49-
49+
5050
<div class="ui-mention-highlight"></div>
51-
51+
5252
<ul class="dropdown" ng-if="$mention.choices.length">
5353
<li ng-repeat="choice in $mention.choices"
5454
ng-class="{active:$mention.activeChoice==choice}"
5555
ng-click="$mention.select(choice)">
5656
{{::choice.first_name}} {{::choice.last_name}}
5757
</li>
5858
</ul>
59-
59+
6060
</div>
6161
```
6262
And the CSS:
@@ -117,7 +117,7 @@ mention.findChoices = _.throttle(function(match) {
117117
}, 300);
118118
```
119119

120-
Hate redundancy? De-dupe that shiz:
120+
Hate redundancy? De-dupe that shiznizzle:
121121
```js
122122
mention.findChoices = function(match, mentions) {
123123
return [ /* choices */ ]
@@ -138,9 +138,8 @@ Your servers are slow? Bitch please.
138138
mention.findChoices = function(match) {
139139
mention.loading = true;
140140
return $http.get(...)
141-
.then( response => {
141+
.finally( response => {
142142
mention.loading = false;
143-
return response.data;
144143
});
145144
}
146145
```

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.5",
3+
"version": "0.0.6",
44
"homepage": "https://github.com/angular-ui/ui-mention",
55
"authors": [
66
"AngularUI Team"

dist/mention.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr =
55
angular.module('ui.mention', []).directive('uiMention', function () {
66
return {
77
require: ['ngModel', 'uiMention'],
8-
controller: 'uiMentionController',
8+
controller: 'uiMention',
99
controllerAs: '$mention',
1010
link: function link($scope, $element, $attrs, _ref) {
1111
var _ref2 = _slicedToArray(_ref, 2);
@@ -19,7 +19,7 @@ angular.module('ui.mention', []).directive('uiMention', function () {
1919
});
2020
'use strict';
2121

22-
angular.module('ui.mention').controller('uiMentionController', function ($element, $scope, $attrs, $q, $timeout, $document) {
22+
angular.module('ui.mention').controller('uiMention', function ($element, $scope, $attrs, $q, $timeout, $document) {
2323
var _this2 = this;
2424

2525
// Beginning of input or preceeded by spaces: @sometext
@@ -76,6 +76,7 @@ angular.module('ui.mention').controller('uiMentionController', function ($elemen
7676

7777
ngModel.$render = function () {
7878
$element.val(ngModel.$viewValue || '');
79+
$timeout(_this.autogrow, true);
7980
_this.render();
8081
};
8182
};

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.5",
3+
"version": "0.0.6",
44
"description": "Facebook-like @mentions for text inputs built around composability",
55
"main": "src/mention.js",
66
"scripts": {

src/mention.es6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ angular.module('ui.mention', [])
22
.directive('uiMention', function() {
33
return {
44
require: ['ngModel', 'uiMention'],
5-
controller: 'uiMentionController',
5+
controller: 'uiMention',
66
controllerAs: '$mention',
77
link: function($scope, $element, $attrs, [ngModel, uiMention]) {
88
uiMention.init(ngModel);

src/mentionController.es6.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
angular.module('ui.mention')
2-
.controller('uiMentionController', function (
2+
.controller('uiMention', function (
33
$element, $scope, $attrs, $q, $timeout, $document
4-
) {
4+
) {
55

66
// Beginning of input or preceeded by spaces: @sometext
77
this.pattern = this.pattern || /(?:\s+|^)@(\w+(?: \w+)?)$/;
@@ -54,6 +54,7 @@ angular.module('ui.mention')
5454

5555
ngModel.$render = () => {
5656
$element.val(ngModel.$viewValue || '');
57+
$timeout(this.autogrow, true);
5758
this.render();
5859
};
5960
};

test/uiMentionController.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe('uiMentionController', () => {
1+
describe('uiMention', () => {
22
let $scope, $attrs, $q, $timeout, $document, createController, ngModelController;
33

44
beforeEach(() => {
@@ -12,7 +12,7 @@ describe('uiMentionController', () => {
1212
$attrs = {};
1313

1414
createController = (el) => {
15-
return $controller('uiMentionController', {
15+
return $controller('uiMention', {
1616
$scope: $scope,
1717
$attrs: $attrs,
1818
$element: el,

test/uiMentionDirective.spec.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
describe('uiMentionDirective', () => {
2-
let Subject, $scope, compileDir, uiMentionController;
2+
let Subject, $scope, compileDir, ctrlInstance;
33

44
beforeEach(() => {
5-
uiMentionController = function () {
6-
uiMentionController.init = this.init = sinon.stub();
5+
ctrlInstance = function () {
6+
ctrlInstance.init = this.init = sinon.stub();
77
};
88

99
module('ui.mention', ($controllerProvider) => {
10-
$controllerProvider.register('uiMentionController', uiMentionController);
10+
$controllerProvider.register('uiMention', ctrlInstance);
1111
});
1212

1313
inject(($injector) => {
@@ -57,10 +57,9 @@ describe('uiMentionDirective', () => {
5757
$scope.model = 'wat';
5858
compileDir('<span ui-mention ng-model="model"></span>');
5959
$scope.$digest();
60-
expect(uiMentionController.init).to.have.been.calledOnce.and.calledWithMatch({
60+
expect(ctrlInstance.init).to.have.been.calledOnce.and.calledWithMatch({
6161
$modelValue: 'wat'
6262
});
6363
});
6464
});
6565
});
66-

0 commit comments

Comments
 (0)