dimanche 9 mai 2021

Closing tag did not match last open tag?

I'm currently learning ember.js through their ember.js guide and so far everything went by without an issue, but now I came across this part: https://guides.emberjs.com/v3.26.0/components/looping-through-lists/#toc_updating-lists

Out of frustration I copied everything 1:1 from the website, but I just get the following error:

Closing tag form (on line 6) did not match last open tag Inputglimmer-engine(syntax)

Closing tag did not match last open tag (on line 2): (error occurred in 'core-components/components/new-message-input.hbs' @ line 6 : column 0)

Here's the code:

new-message-input.hbs:

<form >
  <Input @value=>
  <button type="submit">
    Send
  </button>
</form>

new-message-input.js:

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';

export default class NewMessageInputComponent extends Component {
  @tracked message;

  @action
  createMessage(event) {
    event.preventDefault();

    if (this.message && this.args.onCreate) {
      this.args.onCreate(this.message);

      // reset the message input
      this.message = '';
    }
  }
}

messages.hbs:

<div class="messages">
  
    <Message
      @username=
      @userIsActive=
      @userLocaltime=
    >
      }
    </Message>
  

  <NewMessageInput @onCreate= />
</div>

messages.js:

import Component from '@glimmer/component';
import { action } from '@ember/object';
import { A } from '@ember/array';

export default class MessagesComponent extends Component {
  username = 'Zoey';

  @action
  addMessage(messageText) {
    this.messages.pushObject({
      username: this.username,
      active: true,
      content: `<p>${messageText}</p>`
    });
  }

  messages = A([
    {
      username: 'Tomster',
      active: true,
      localTime: '4:56pm',
      content: `
        <p>
          Hey Zoey, have you had a chance to look at the EmberConf
          brainstorming doc I sent you?
        </p>
      `
    },
    {
      username: 'Zoey',
      active: true,
      content: `
        <p>Hey!</p>

        <p>
          I love the ideas! I'm really excited about where this year's
          EmberConf is going, I'm sure it's going to be the best one yet.
          Some quick notes:
        </p>

        <ul>
          <li>
            Definitely agree that we should double the coffee budget this
            year (it really is impressive how much we go through!)
          </li>
          <li>
            A blimp would definitely make the venue very easy to find, but
            I think it might be a bit out of our budget. Maybe we could
            rent some spotlights instead?
          </li>
          <li>
            We absolutely will need more hamster wheels, last year's line
            was <em>way</em> too long. Will get on that now before rental
            season hits its peak.
          </li>
        </ul>

        <p>Let me know when you've nailed down the dates!</p>
      `
    }
  ]);
}



Aucun commentaire:

Enregistrer un commentaire