0

My code:

<!DOCTYPE html>
<head>
 <title>Learning AngularJS</title>
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"     type="text/javascript"></script>
</head>
<body>
  <div class="container" style="background: #eec; min-height:300px; margin-top: 15px;" ng-controller="SimpleController">
    <ul>
      <li ng-repeat="woman in customer">{{ woman.name }}</li>
    </ul>
  </div>

JS (controller and data):

<script>
  function SimpleController($scope) {
    $scope.customer = [
      { name: 'Kamila', city: 'Opava' }, 
      { name: 'Nikola', city: 'Opočno' }, 
      { name: 'Jana', city: 'Pardubice' }, 
      { name: 'Martina', city: 'Hradec Kralove' }, 
      { name: 'Justýna', city: 'Chrudim' }
    ];
  };
</script>
</body>
</html>

Result my browser: {{ woman.name }} only

I do not know where is the mistake.

2 Answers 2

4

You did not declare the app. Example:

<html ng-app="phonecatApp">

See details on AngularJS example

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

Comments

2

Please see here http://jsbin.com/vaweyu/1/edit

HTML:

<html ng-app="app">
<head>
 <title>Learning AngularJS</title>

 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"     type="text/javascript"></script>
</head>
<body>
  <div class="container" style="background: #eec; min-height:300px; margin-top: 15px;" ng-controller="SimpleController">
    <ul>
      <li ng-repeat="woman in customer">{{ woman.name }}</li>
    </ul>
  </div>
</html>

JS:

var app = angular.module("app", []);


   app.controller('SimpleController', function ($scope) {
        $scope.customer = [
          { name: 'Kamila', city: 'Opava' }, 
          { name: 'Nikola', city: 'Opočno' }, 
          { name: 'Jana', city: 'Pardubice' }, 
          { name: 'Martina', city: 'Hradec Kralove' }, 
          { name: 'Justýna', city: 'Chrudim' }
        ];
      });

Comments

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.