Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I am currently have trouble displaying my array using the "Controller as" syntax if I pass the $scope in to my controller it works fine but using the "Controller as" syntax and this. My array does not appear on the page I'm just wondering if I am doing something wrong?

Here is the JSBin

http://jsbin.com/qufevalenoda/1/edit?html,js,output

share|improve this question
1  
Should be <p ng-repeat="post in main.posts">{{ post }}</p> – Anthony Chu Oct 3 '14 at 20:48
    
Ahhh thanks you!!! Anthony! Stupid little mistakes – Enjayy Oct 3 '14 at 20:53

http://jsbin.com/qufevalenoda/3/edit

<div ng-controller="MainCtrl as main">
    {{ main.title }} <br> <br>
    {{ main.posts }}
    <p ng-repeat="post in main.posts">
        {{ post }}
    </p>
</div>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.