2
0
Эх сурвалжийг харах

fix two-way filter in attribute interpolations (fix #779)

Evan You 11 жил өмнө
parent
commit
d8335c25a6

+ 2 - 1
src/parsers/text.js

@@ -169,7 +169,8 @@ function inlineFilters (exp) {
         var args = filter.args
           ? ',"' + filter.args.join('","') + '"'
           : ''
-        exp = 'this.$options.filters["' + filter.name + '"]' +
+        filter = 'this.$options.filters["' + filter.name + '"]'
+        exp = '(' + filter + '.read||' + filter + ')' +
           '.apply(this,[' + exp + args + '])'
       }
       return exp

+ 1 - 1
test/unit/specs/parsers/text_spec.js

@@ -119,7 +119,7 @@ describe('Text Parser', function () {
   it('tokens to expression with filters, multiple expressions', function () {
     var tokens = textParser.parse('a {{b | c d}} e')
     var exp = textParser.tokensToExp(tokens)
-    expect(exp).toBe('"a "+this.$options.filters["c"].apply(this,[b,"d"])+" e"')
+    expect(exp).toBe('"a "+(this.$options.filters["c"].read||this.$options.filters["c"]).apply(this,[b,"d"])+" e"')
   })
 
 })