Curriculum
Course: AngularJS
Login

Curriculum

AngularJS

AngularJS Tutorial

0/65
Text lesson

Application Explained

Step 1. Getting Started:

Create an application named myShoppingList and add a controller called myCtrl, which initializes a products array in the $scope. Use the ng-repeat directive in the HTML to display the array items.

Example

So far, we have created an HTML list using the items from an array.

<script>
var app = angular.module(“myShoppingList”, []);
app.controller(“myCtrl”function($scope) {
  $scope.products = [“Milk”“Bread”“Cheese”];
});
</script>

<div ng-app=”myShoppingList” ng-controller=”myCtrl”>
  <ul>
    <li ng-repeat=”x in products”>{{x}}</li>
  </ul>
</div>