AngularJS tutorial step 2
This commit is contained in:
parent
ddebf832ee
commit
4e20973f9d
2 changed files with 22 additions and 3 deletions
frontend
12
frontend/assets/js/controllers.js
Normal file
12
frontend/assets/js/controllers.js
Normal 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.'}
|
||||
];
|
||||
});
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue