Skip to content

Literal Array trailing comma in expressions causes error #20773

@FrancescoBorzi

Description

@FrancescoBorzi

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

The following works:

<div
  *ngIf="[
  'first value',
  'last value'
  ].indexOf(myVar) > -1"
></div>

the following gives error:

<div
  *ngIf="[
  'first value',
  'last value',
  ].indexOf(myVar) > -1"
></div>

the difference is the trailing comma in the array of the *ngIf condition.

Expected behavior

It should work still it's still valid javascript

Environment


Browser:
Chrome (desktop) Version:  62.0.3202.94 (Official Build) (64-bit)

Environment:

Angular CLI: 1.5.5
Node: 8.9.1
OS: linux x64
Angular: 5.0.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.5
@angular-devkit/build-optimizer: 0.0.34
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.38
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.5
@schematics/angular: 0.1.8
typescript: 2.4.2
webpack: 3.8.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions