1

I'm getting into angular, but am coming across a wacky problem. I'm sure I'm making a dumb mistake, but don't know what it is.

In my controller, I do the following ->

angular.module('foo')
  .controller('AdminCtrl', ['$scope', '$http'], (s, $http) ->
    s.foo = []

    $http
      method: 'GET'
      url: cfg.api '/foo'
    .success (data) ->
      s.foo = _(data).map (item) ->
          wid: item

Then in html, I write ->

 <li ng-repeat"bar in foo">
    <p>{{foo}}</p>
 </li>

I'm expecting for li to print out bar.length times, but it actually only prints out once.

This made me think that foo wasn't a proper array, but {{foo}} returns

[{...}, {...}, {...}]

What's going on here?

1 Answer 1

2
<li ng-repeat="bar in foo">
   <p>{{bar}}</p> 
</li>

try this?

Sign up to request clarification or add additional context in comments.

2 Comments

oh my god... this is embarassing. Thank you com3lius!
For ref. The problem was with the ng-repeat"bar in foo", forgot the equal sign!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.