diff --git a/src/ng/parse.js b/src/ng/parse.js index 50da14fa0770..e9c0aa38bf4f 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -659,8 +659,8 @@ Parser.prototype = { equality: function() { var left = this.relational(); var token; - if ((token = this.expect('==','!=','===','!=='))) { - left = this.binaryFn(left, token.fn, this.equality()); + while ((token = this.expect('==','!=','===','!=='))) { + left = this.binaryFn(left, token.fn, this.relational()); } return left; }, @@ -668,8 +668,8 @@ Parser.prototype = { relational: function() { var left = this.additive(); var token; - if ((token = this.expect('<', '>', '<=', '>='))) { - left = this.binaryFn(left, token.fn, this.relational()); + while ((token = this.expect('<', '>', '<=', '>='))) { + left = this.binaryFn(left, token.fn, this.additive()); } return left; }, diff --git a/test/ng/parseSpec.js b/test/ng/parseSpec.js index a76fa86b6de4..f2b6dfd6b6cd 100644 --- a/test/ng/parseSpec.js +++ b/test/ng/parseSpec.js @@ -252,6 +252,8 @@ describe('parser', function() { expect(scope.$eval("2>=1")).toEqual(2>=1); expect(scope.$eval("true==2<3")).toEqual(true == 2<3); expect(scope.$eval("true===2<3")).toEqual(true === 2<3); + expect(scope.$eval("1===1===true")).toEqual(1 === 1 === true); + expect(scope.$eval("1<2<=1")).toEqual(1 < 2 <= 1); }); it('should parse logical', function() {