File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -282,7 +282,7 @@ We will fetch all books and render them in our template. In routes/books.js:
282282= export default class BooksRoute extends Route {
283283+ @service store;
284284+
285- + model(){
285+ + model() {
286286+ return this.store.findAll('book');
287287+ }
288288= }
@@ -313,12 +313,12 @@ In the app/templates/book.hbs template, we’ll add our create fields and button
313313+ <dt>Book title</dt>
314314+ <dd>
315315+ <Input @value={{this.newTitle}}
316- + @ placeholder="Thinking Fast and Slow" />
316+ + placeholder="Thinking Fast and Slow" />
317317+ </dd>
318318+ <dt>ISBN</dt>
319319+ <dd>
320320+ <Input @value={{this.newIsbn}}
321- + @ placeholder="978-0374533557" />
321+ + placeholder="978-0374533557" />
322322+ </dd>
323323+ </dl>
324324+ <button type="submit">Create</button>
@@ -346,9 +346,9 @@ We’ll add this action in the controller and make it create the new book. In a
346346+ // create the new book
347347+ const book = this.store.createRecord('book', {
348348+ title: this.newTitle,
349- + isbn: this.newIsbn
349+ + isbn: this.newIsbn,
350350+ });
351- + book.save()
351+ + book.save();
352352+ // clear the input fields
353353+ this.newTitle = '';
354354+ this.newIsbn = '';
@@ -365,7 +365,7 @@ In app/templates/book.hbs we alter:
365365``` diff
366366= <li>
367367= {{book.title}}<small>{{book.isbn}}</small>
368- + <button {{on "click" (fn this.removeBook book)}}>Remove</button>
368+ + <button type="button" {{on "click" (fn this.removeBook book)}}>Remove</button>
369369= </li>
370370```
371371
You can’t perform that action at this time.
0 commit comments