I am using Angular with SilverStripe for my backend. I am using this module https://github.com/silverstripe/silverstripe-restfulserver for my REST API instead of building it myself.
When the API returns a list with a many_many relationship it looks like
<Recipe href="http://localhost/groceryList/api/v1/Recipe/2.xml">
<Title>Chilli</Title>
<ID>2</ID>
<Ingredients linktype="many_many" href="http://localhost/groceryList/api/v1/Recipe/2/Ingredients.xml">
<Ingredient href="http://localhost/groceryList/api/v1/Ingredient/5.xml" id="5"/>
<Ingredient href="http://localhost/groceryList/api/v1/Ingredient/6.xml" id="6"/>
<Ingredient href="http://localhost/groceryList/api/v1/Ingredient/7.xml" id="7"/>
</Ingredients>
</Recipe>
My question is 2 part.
Why is the collection of ingredients a bunch of links? I was hoping it would contain the name of each ingredient. Is this how REST is suppose to work?
Using Angular $Resource, how can easily get the ingredients to loop through using ng-repeat?