slm: Doesn't work with new Angular 2 attribute syntax

Basically something like this:

div([value]="boundValue")

Throws a syntax error saying it is expecting an attribute. I’m assuming that is because SLM/SLIM expect [] to be used to surround attribute lists. I see no reason this can’t be supported however.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 18 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@Systho yes as mentioned above just write this: template="ngFor #item of list"

So I’ve done some more comprehensive testing and found the following do not work:

Does not work

  • *ngFor="#item of list'
  • [] syntax for input bindings
  • () syntax for output bindings

Does work

  • *ngIf='something'
  • template="ngFor #item of list"
  • bind-thing="otherThing" syntax for input bindings
  • on-thing="doThing()" syntax for output bindings

Specifically it seems the *ngFor syntax only breaks because it is followed by a value that starts contains spaces. You will find the the following statements compile fine (although they don’t do anything):

  • *ngFor='#item'
  • *ngFor='anything

For the time being there are reasonable workarounds for everything, (in fact I may even prefer the bind- and on- syntaxes). However I do feel it is important to be able to support Angular 2’s templates.