0

I want all posts on post.hbs but it's not displaying any post list, I want check title with my string and display particular post on post.hbs.

Below code is not working in post.hbs

{{#foreach posts}}
     <p>{{content}}</p>
{{/foreach}}`

Its not working on post.hbs page

tom redfern
  • 30,562
  • 14
  • 91
  • 126
HARDIK THAKOR
  • 161
  • 2
  • 12
  • what is post.hbs? Is it just a file Have you tried to generate array and then print it like posts.content You can't get any content afaik in loop. – Mrugank Dhimmar Dec 09 '16 at 11:14

1 Answers1

1

Post.hbs is for displaying a specific post, so you are in {{post}} scope:

{{#post}}
{{/post}}

You can try something like this:

{{#get "posts" limit="all" as |allposts| }}
    {{#foreach allposts}}
       {{content}}
    {{/foreach}}
{{/get}}
Norbert
  • 76
  • 5