diff options
| author | Renat Yakubov | 2014-03-24 22:44:08 +0300 |
|---|---|---|
| committer | Tobias Bosch | 2014-03-24 16:11:28 -0700 |
| commit | a275d539f9631d6ec64d03814b3b09420e6cf1ee (patch) | |
| tree | 27807e2473525fe238d1fe5103b5f067794fce6e | |
| parent | 17fa2468bc5223edcd7294ddfd9fc02003a80e94 (diff) | |
| download | angular.js-v1.2.x.tar.bz2 | |
fix(filter.ngdoc): Check if "input" variable is definedv1.2.x
By default, "greeting" textfield in this example is prepopulated with "hello" text, but it's pretty easy to copy just filter code to use it in your app. If your textfield is empty while app loads, you'll get an error: "Error: [$interpolate:interr] Can't interpolate: Reverse: {{greeting|reverse}} TypeError: Cannot read property 'length' of undefined". To prevent this, we should check "input" variable, and proceed only in case it is defined.
Closes #6819.
| -rw-r--r-- | docs/content/guide/filter.ngdoc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/docs/content/guide/filter.ngdoc b/docs/content/guide/filter.ngdoc index 8eedf14c..9ef8bcc0 100644 --- a/docs/content/guide/filter.ngdoc +++ b/docs/content/guide/filter.ngdoc @@ -103,6 +103,7 @@ text upper-case. angular.module('MyReverseModule', []). filter('reverse', function() { return function(input, uppercase) { + input = input || ''; var out = ""; for (var i = 0; i < input.length; i++) { out = input.charAt(i) + out; |
