I am currently following an Angular series on Lynda.com and facing a roadblock. Although I am new to Angular, the main issue is that I am attempting to iterate through data in order to fetch images from a folder and assign an h1 name to each image. Below is the code snippet:
var myApp = angular.module('myApp', []);
//The Above Creates the variable set to an angular module
//The following links the controller
myApp.controller('MyController', function MyController($scope) {
$scope.students = [{
"name" : "Pedro Cunha",
"shortname" : "Pedro_Cunha",
"reknown" : "Front End Developer",
"bio" : "Aspiring to become a front end dev."
},
{
"name" : "Miguel Fonduer",
"shortname" : "Miguel_Fondeur",
"reknown" : "Front End Developer",
"bio" : "Looking for become the next stack creator"
},
{
"name" : "Dmitry Pavluk",
"shortname" : "Dmitry_Pavluk",
"reknown" : "UI/UX Engineer",
"bio" : "Best questions ever"
},
{
"name" : "Ethan Robinson",
"shortname" : "Ethan_Robinson",
"reknown" : "Biz Development/Marketing",
"bio" : "Can analyze and sell the shit out of anything"
},
{
"name" : "Xin Wang",
"shortname" : "Xin_Wang",
"reknown" : "Product Manager",
"bio" : "Gets shit done"
}
}];
HTML
<!DOCTYPE html>
<html lang="en" ng-app="myApp"> <!-- This Tells you which module to reference -->
<head>
<meta charset="UTF-8">
<title>Angular Demo</title>
<script src="../lib/angular/angular.min.js"></script>
<script src="../js/controllers.js"></script>
<link rel="stylesheet" href="../css/style.css">
</head>
<body>
<div class="main" ng-controller = "MyController">
<h2>{{students.name}}</h2>
<ul class="studentlist">
<li class="student cf" ng-repeat="student in students">
<img src="../images/{{student.shortname}}_tn.jpg" alt="Photo of {{student.name}}">
<div class="info">
<h2>{{student.name}}</h2>
<h3>{{student.reknown}}</h3>
</div>
<li>
</ul>
</div>
</body>
</html>
CSS
...I suspect that the problem lies in Angular not binding properly. I am unsure how to resolve this issue. There are no errors visible in the console, yet the functionality stopped working once I enclosed it in "". Any assistance on resolving this matter would be greatly appreciated. Thank you!