AngularJS tutorial step 2

This commit is contained in:
Adrian 2015-11-24 23:57:07 +01:00
parent ddebf832ee
commit 4e20973f9d
2 changed files with 22 additions and 3 deletions
frontend

View file

@ -0,0 +1,12 @@
var phonecatApp = angular.module('phonecatApp', []);
phonecatApp.controller('PhoneListCtrl', function ($scope) {
$scope.phones = [
{'name': 'Nexus S',
'snippet': 'Fast just got faster with Nexus S.'},
{'name': 'Motorola XOOM™ with Wi-Fi',
'snippet': 'The Next, Next Generation tablet.'},
{'name': 'MOTOROLA XOOM™',
'snippet': 'The Next, Next Generation tablet.'}
];
});

View file

@ -1,13 +1,20 @@
<!doctype html>
<html lang="en" ng-app>
<html lang="en" ng-app="phonecatApp">
<head>
<meta charset="utf-8">
<title>Angular tutorial</title>
<script src="vendor/angular/angular.min.js"></script>
<script src="assets/js/controllers.js"></script>
</head>
<body>
<p>Nothing here {{'yet' + '!'}}</p>
<body ng-controller="PhoneListCtrl">
<ul>
<li ng-repeat="phone in phones">
<span>{{phone.name}}</span>
<p>{{phone.snippet}}</p>
</li>
</ul>
</body>
</html>