Probleme d'un div cliquable

kina90 Messages postés 165 Date d'inscription   Statut Membre Dernière intervention   -  
kina90 Messages postés 165 Date d'inscription   Statut Membre Dernière intervention   -
bonsoir a tous,
je suis debutante en programmation, je fais une app web qui gere une ecole.
la partie frontend est faite:java,DB Mysql.
je suis bloqué maintenant dans la partie frontend.Alors j'ai créé ma page html en utilisant angular et puisque je suis debutante je trouve pas mal de difficulté au niveau de la manipulation de mon DOM.
je veux afficher la liste de tous les etudiants de l'ecole:
En HTML j'ai mis les cordonnées de chaque etudiant dans un div cliquable. je veux que a chaque fois je selectionne un etudiant, il doit me rediriger vers une autres pages ou les coordonnés de l'etudiant selectionné s'affichent dansdes input text d'une autre page comme ca je peux les modifier a'laide d'une methode que j'ai defini dans le controlleur(update). je n'ai pas comment je dois proceder.
aidez moi s'il vous plait!!!


mon code HTML:
<html>
<head>
<title> School </title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="controller/school.js"></script>
<link
rel="stylesheet"
type="text/css"
href="css/style.css">

</head>
<body ng-app="school" ng-controller="schoolcontroller">

<div>
<a href="newstudent.html" > Add new student</a>
<div>
<div ng-repeat="student in school.students">

<!-- <a ng-href="updatestudent.html?name={{student.name}}" style="display:inline-block;">-->


<div class="stud">
{{student.name}} {{student.surname}}<br>
SIN :{{student.sin}}<br>
Date of birthday:{{student.birth}}<br>
Section :{{student.section}}<br>
Year :{{student.year}}<br>
Italian vote :{{student.italian}}<br>
Math Vote :{{student.math}}<br>
English Vote :{{student.english}}<br>
Info learn :{{student.info}} <br>
</a>
<input type="button" value="delete" ng-click="updatestudent.html" />
</div>
<form ng-show>
<input type="text" ng-model="student.sin" /><br>
<input type="text" ng-model="student.name" /><br>
<input type="text" ng-model="student.surname" /><br>
<input type="text" ng-model="student.birth" /><br>
<input type="text" ng-model="student.section" /><br>
<input type="text" ng-model="student.year" /><br>
<input type="text" ng-model="student.italian" /><br>
<input type="text" ng-model="student.math" /><br>
<input type="text" ng-model="student.english" /><br>
<input type="text" ng-model="student.info" /><br>
<input type="button" value="save" ng-click="school.update(student)" />
</form>
</div>

</body>

</html>
A voir également:

1 réponse

kina90 Messages postés 165 Date d'inscription   Statut Membre Dernière intervention   1
 
-------------------------------------------------------------------------
mon controlleur :

var app = angular.module("school", []);
app.controller("schoolcontroller", function($scope,$http)
{
//caricamento iniziale

$http.get("Index?cmd=list")
.then
(
function(response)
{
$scope.school.students = response.data;
}
);


$scope.school =
{
students:[],

update:function(s)
{

$http.get("Index?cmd=update&sin="+s.sin+"&name="+s.name+
"&surname="+s.surname+"&birth="+s.birth
+"§ion="+s.section+"&year="+s.year+
"&italian="+s.italian+"&italian="+s.italian+
"&math="+s.math+"&english="+s.english
+"&info="+s.info)
.then
(
function(response)
{
$scope.school.students = response.data;
}
);

},

add:function(s)
{

//var sin = prompt('SIN. Mine is pride');
$http.get("Index?cmd=add&sin="+s.sin+"&name="+s.name+
"&surname="+s.surname+"&birth="+s.birth
+"§ion="+s.section+"&year="+s.year+
"&italian="+s.italian+"&italian="+s.italian+
"&math="+s.math+"&english="+s.english
+"&info="+s.info) .then
(
function(response)
{
$scope.school.students = response.data;


}
);




},
delete:function(s)
{
if(!s)
{
alert('Hey amico...');
return;
}

$http.get("Index?cmd=delete&sin="+s.sin)
.then
(
function(response)
{
$scope.school.students = response.data;

}
);

}
};




});
0