Javascript HTML变量值未传递到HTML标记中的app.controller属性

Javascript HTML变量值未传递到HTML标记中的app.controller属性,javascript,html,angularjs,web-frontend,Javascript,Html,Angularjs,Web Frontend,我正在开发一个基本的学生-教师web应用程序,其中我正在使用angular JS构建前端。我的JS文件中有两个应用程序控制器,一个用于检索学生,另一个用于检索分配给每个学生的科目 我将学生id作为属性{{student.id}传递给应用程序控制器时遇到问题,因为它只是作为字符串{{student.id}传递,而不是传递{{student.id}的实际值 出现问题的html代码片段 <div ng-controller="studentController" class="container

我正在开发一个基本的学生-教师web应用程序,其中我正在使用angular JS构建前端。我的JS文件中有两个应用程序控制器,一个用于检索学生,另一个用于检索分配给每个学生的科目

我将学生id作为属性{{student.id}传递给应用程序控制器时遇到问题,因为它只是作为字符串{{student.id}传递,而不是传递{{student.id}的实际值

出现问题的html代码片段

<div ng-controller="studentController" class="container">

    <table class="table">
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Subjects</th>
        </tr>
        <tr ng-repeat="student in students">
            <td id>{{student.id}}</td>
            <td>{{student.Name}}</td>
            <td ng-controller="subjectController"
                id = {{student.id}}>
             {{subjects}}
            </td>
        </tr>
    </table>

subjectController
应从其父作用域继承属性:

app.controller("subjectController", function($scope) {
    console.log($scope.student.id); 
    console.log($scope.students); //Inherited from parent scope
});
有关详细信息,请参阅


一个
元素需要一个AngularJS控制器,这似乎很奇怪。如果您坚持这样做,请显示该控制器的代码,以便我们可以帮助您。万分感谢!这正是我想要达到的。我的方法完全失败了,因为我没有利用对JS文件中父作用域的访问。
<td ng-controller="subjectController" id = 1> {{subjects}}</td>
app.controller('studentController', function($scope, $location, $http) {
    $http.get('http://localhost:8080/getStudents')
    .then(function(response) {
        $scope.students = response.data;
    });

});

app.controller('subjectController', function($scope, $attrs, $location, $http) {
    $http.get('http://localhost:8080/getSubjects?ID='+ $attrs.id)
            .then(function(response) {
                $scope.subjects = response.data;
            });

});

app.controller("subjectController", function($scope) {
    console.log($scope.student.id); 
    console.log($scope.students); //Inherited from parent scope
});