505970 (10) [Avatar] Offline
While going through chapter 4 Templates I see that originalNumberOfBooks is camel case in the view-model but in the view it is cabob case with the (dot) .one time. why is it cabob case and not just all lowercase or camel case?

Thank you,
Sean Hunter (29) [Avatar] Offline
Thanks for the feedback. This should be consistent. I'll review the listings around that and correct for the upcoming MEAP smilie.

505970 (10) [Avatar] Offline
I think the listings are correct. Typescript throws a compile error if it is any other way then cabob case, I was just wondering way that is? Is that the convention for multiple word attributes?
Sean Hunter (29) [Avatar] Offline
Ah yes, my apologies. I didn't read this correctly.

Aurelia uses InitCase within view-models and kebab-case in view templates. The naming convention is described here:


505970 (10) [Avatar] Offline
I think there may be some confusion. I'm not referring to the file naming convention. in book-stats we have a property named originalNumberOfBooks like bellow
import {computedFrom, bindable} from 'aurelia-framework';
export class BookStats{
  @bindable books;
  @bindable originalNumberOfBooks;
  @computedFrom('originalNumberOfBooks', 'books.length')
  get addedBooks(){
      return this.books.length—this.originalNumberOfBooks;

then in books.html we bind to it as bellow
<require from="./book-stats"></require>
<book-stats if.bind="books.length > 0"

Then my question is why is the binding original-number-of-books.one-time instead of originalNumberOfBooks.one-time or originalnumberofbooks.one-time? is the kebob case in the html a convention and so should be followed for multi-worded properties?

when trying both originalNumberOfBooks.one-time or originalnumberofbooks.one-time I get a build error specifying to try the original-number-of-books instead.
Sean Hunter (29) [Avatar] Offline
Ah ok yes that makes sense, apologies for the delayed reply.

Generally, the convention indicates that everything should be kebab-case in the view with the exception of when you have a JavaScript expression in you binding (for example: click.delegate="removeBook($index)").