Can't see the expressions while using ng-repeat


#1

Hi everyone :sunglasses:.
I really can't figure out what's the problem with my code.
I try to loop over the appetizers object in order to present his data on the view using ng-repeat directive.
I get the expression syntax instead of the data itself.

here is my controller:

app.controller('MainController', ['$scope', function($scope) {
$scope.today = new Date();

$scope.appetizers = [
{
name: 'Caprese',
description: 'Mozzarella, tomatoes, basil, balsmaic glaze.',
price: 4.95
},
{
name: 'Mozzarella Sticks',
description: 'Served with marinara sauce.',
price: 3.95
},
{
name: 'Bruschetta',
description: 'Grilled bread garlic, tomatoes, olive oil..',
price: 4.95
}
];

}]);

Here is my relevant html:

<div ng-controller="MainController" class="main">
  <div class="container">
    <h1>Specials for {{ today | date }}</h1>
    
    <h2>Appetizers</h2>
    <div ng-repeat='appetizer in appetizers' class="appetizers row">
      <div  class="item col-md-9">
        <h3 class="name">{{appetizer.name}} </h3>
        <p class="description"> {{appetizer.description}} </p>
      </div>
      <div class="price col-md-3">
        <p class="price"> {{appetizer.price | currency}} </p>
      </div>
    </div>

  </div>
</div>

Can you please tell me what's wrong ?
Best regards.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.