Jake Wansink Jake Wansink - 1 year ago 85
HTML Question

AngularJS not printing variable

I'm currently building my first single page app with angularJS. The variable information stored in my controller is not displaying on the page. After extensively trying to trouble-shoot this I am at a loss to why it isn't displaying.

<div ng-repeat="x in pers" class="person">
<div class="name">{{ pers.person }}</div>
<div class="out">Out</div>
<div class="in" >In</div>
<div class="onsite">On site</div>
<div class="notes">
<div class='n'></div>
<div class='dn'>Delete note</div>
<div class='an'>Add note</div>

My controller looks like this.

app.controller("MainController", ['$scope', function($scope) {
$scope.pers = [
person: 'Nick',
person: "Greg",

The repeat function works as expected and two tables are formed, however both the
s with the class name are left without any text in them on the page. I have tried using
as well without any success.

Thanks in advance for any help you can offer with this issue I'm having.

Answer Source

it should be {{x.person}} you are using ng-repeat of pers with the alias x

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download