Wednesday, April 25, 2018

How to get value from an array in vue.js - development

How to get value from an array in vue.js

I have an array:

{ "id": 1, 
  "title": "Incidunt facere placeat nulla occaecati voluptatem voluptatem minus.", 
  "categories": [ 
     { "id": 1, 
      "name": "News", 
      "created_at": "2018-04-23 18:05:47", 
      "updated_at": "2018-04-23 18:05:47", 
      "pivot": { 
      "post_id": 1, 
      "category_id": 1 } }, { 
      "id": 2, 
      "name": "Sport", 
      "created_at": "2018-04-23 18:05:47", 
      "updated_at": "2018-04-23 18:05:47", 
      "pivot": { 
        "post_id": 1, 
        "category_id": 2 
        } 
       } 
     ]}

I can simply use to have the post title, but when I do it returns null because its not an array.

Is there anyway to have category name?



from Laravel Questions and Answers https://laravelquestions.com/laravel/how-to-get-value-from-an-array-in-vue-js/
via Lzo Media

No comments:

Post a Comment