diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index 9fd2077dca65..292ecb1666f9 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -126,8 +126,8 @@ var ngOptionsDirective = valueFn({ terminal: true }); var selectDirective = ['$compile', '$parse', function($compile, $parse) { - //0000111110000000000022220000000000000000000000333300000000000000444444444444444440000000005555555555555555500000006666666666666666600000000000000007777000000000000000000088888 - var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/, + //00001111100000000000222200000000000000000000003333000000000000004444444444444444400000000055555555555555555000000066666666666666666000000000000000077770000000000000000000888880009999999 + var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$[\s\n]*/, nullModelCtrl = {$setViewValue: noop}; return { diff --git a/test/ng/directive/selectSpec.js b/test/ng/directive/selectSpec.js index 584fe6140e59..cc0248bbb1d7 100644 --- a/test/ng/directive/selectSpec.js +++ b/test/ng/directive/selectSpec.js @@ -494,7 +494,13 @@ describe('select', function() { it('should throw when not formated "? for ? in ?"', function() { expect(function() { compile(''); - }).toThrowMinErr('ngOptions', 'iexp', /Expected expression in form of/); + }).toThrowMinErr('ngOptions', 'iexp', /Expected expression in form of/); + }); + + it('should accept new lines in the format', function(){ + compile(''); + + expect(element).toBeValid(); });