So I am working on a web-application made for teams. I already have the log-in and sign-up page implemented and some of the members of my group are working on the server (node.js with express framework) and database side and I am working on the frond-end/client-side using angularjs framework. I need to make a "team list page" in angularjs that basically fetches an array of team names (a person who is logged in may have several different software dev groups he/she may be working with).
The server side of team_list.html has not been implemented yet but will be after I am done with the client-side.
My problem is: I am not sure how to fetch an array from the server/database side in angularjs. I know that I should be using the ng-repeat directive somehow and also the GET method but I am not exactly sure how to do that. Especially how to do that with arrays.
Here is my code for team_list.html so far:
var page = angular.module('teamListPage', []);
page.controller('listController', function($scope, $http) {
console.log("inside the controller");
//need to figure out how to pass info to server to retrieve the correct page
$scope.submit = function() {
console.log("inside the login function");
console.log()
}
$scope.enterTeamPage = function() {};
}
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
title>Team List</title>
</head>
<body>
<h1>
Welcome to Your Team Pages!
</h1>
<div ng-controller="listController">
<form id="Teams" ng-app="teamListPage">
<fieldset>
<legend>Your Teams</legend>
<ul>
<div ng-repeat"x in teamList">
<td>{{x.Name}}</td>
<p>
<input type="button" id="enter" name="enter" value="Enter Home Page" />
</p>
</div>
</ul>
</fieldset>
</form>
</div>
<p>
<input type="button" id="Create" name="Create" value="Create New Team" />
</p>
</body>
</html>
$http.get
? see: stackoverflow.com/questions/18477711/… – jmunsch 22 hours ago