lundi 4 janvier 2016

Errors not populated

I receive errors from the backend:

{
  "errors": {
    "extra_comments": [
      "This field may not be null."
    ],
    "name": [
      "This field may not be null."
    ],
    "due_date": [
      "This field may not be null."
    ],
    "price": [
      "This field may not be null."
    ],
    "payment_type": [
      "This field may not be null."
    ],
    "description": [
      "This field may not be null."
    ]
  }
}

I try to show them in my template:

{{#each model.errors.messages as |message|}}
  <div class="error">
    {{message}}
  </div>
{{/each}}

Nothing is shown. A problem with EmberData? A problem with changes in Ember template syntax? A problem with Ember? The adapter? My backend? No idea. The problem surface is too big. How can I:

  • display the received ajax reply?
  • make sure that EmberData is processing the reply and populating model.errors?
  • Show the processed model.errors in the console?

In general, I am experiencing that new versions of Ember are very hard to debug. Whenever I show any Ember object in the console, I just see some Computed properties which are not computed whenever I try to peek into them.




Aucun commentaire:

Enregistrer un commentaire