Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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 at 20:48
    
Ahhh thanks you!!! Anthony! Stupid little mistakes –  Enjayy Oct 3 at 20:53

1 Answer 1

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.