Skip to content

Commit 7881f8e

Browse files
committed
Link function of the provided service will only be called once to prevent memory leaks
1 parent fc05938 commit 7881f8e

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ See [contributing guide](.github/CONTRIBUTING.md)
136136

137137
| Date | Version | Description |
138138
| ----------- | ------- | ----------- |
139-
| 2017-11-07 | v1.0.37 | Maintenance |
139+
| 2018-02-01 | v1.0.38 | Link function of the provided service will only be called once to prevent memory leaks |
140140
| 2016-07-11 | v0.0.27 | Service can now provide min/max/step values and template values override service values |
141141
| 2016-06-14 | v0.0.22 | Published via NPM (in addition to bower) |
142142
| 2016-05-17 | v0.0.14 | Directive element now listens to new number-input$update-model event |

angular-number-input.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
var formatter;
170170
var service;
171171
var serviceState = {};
172+
var linkCalled = false;
172173

173174
/**
174175
* Sets the config for the service in case of any config change.
@@ -223,8 +224,9 @@
223224
* @private
224225
*/
225226
var initFunctionsFromService = function () {
226-
if (service.link) {
227+
if (service.link && !linkCalled) {
227228
service.link(scope, element, attrs, ngModelCtrl);
229+
linkCalled = true;
228230
}
229231

230232
if ((!validation) && service.validate) {

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-number-input",
3-
"version": "1.0.37",
3+
"version": "1.0.38",
44
"description": "AngularJS number input directive.",
55
"authors": [
66
"Sagie Gur-Ari <[email protected]>"

docs/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
| Date | Version | Description |
22
| ----------- | ------- | ----------- |
3-
| 2017-11-07 | v1.0.37 | Maintenance |
3+
| 2018-02-01 | v1.0.38 | Link function of the provided service will only be called once to prevent memory leaks |
44
| 2016-07-11 | v0.0.27 | Service can now provide min/max/step values and template values override service values |
55
| 2016-06-14 | v0.0.22 | Published via NPM (in addition to bower) |
66
| 2016-05-17 | v0.0.14 | Directive element now listens to new number-input$update-model event |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-number-input",
3-
"version": "1.0.37",
3+
"version": "1.0.38",
44
"description": "AngularJS number input directive.",
55
"author": {
66
"name": "Sagie Gur-Ari",

0 commit comments

Comments
 (0)