Javascript 我有3个控制器从数据库获取数据列表,并在下拉列表中显示,但当它被选中时,它不会';t获取列表的选定值

Javascript 我有3个控制器从数据库获取数据列表,并在下拉列表中显示,但当它被选中时,它不会';t获取列表的选定值,javascript,angularjs,Javascript,Angularjs,这一个是页面的主控制器和模块 var bookinsert = angular.module('bookinsert', ['ngCookies']); bookinsert.controller('book_insert_ctrl', function ($scope, $http, $rootScope, $cookies) { $scope.func = function () { var writer = $scope.writer, title = $scope.title,

这一个是页面的主控制器和模块

var bookinsert = angular.module('bookinsert', ['ngCookies']);
bookinsert.controller('book_insert_ctrl', function ($scope, $http, $rootScope, $cookies) {

$scope.func = function () {
    var writer = $scope.writer, title = $scope.title, genre = $scope.genre, language = $scope.lang, category=$scope.categ, publisher = $scope.publisher, publish_date = $scope.publish_date, isbn = $scope.isbn, page_count = $scope.page_count, cost = $scope.cost, books_instock = $scope.books_instock,review = $scope.review,book_image_1 = $scope.book_image_1,book_image_2 = $scope.book_image_2,book_image_3 = $scope.book_image_3,user_id = $cookies.get('user_id_cook');

    var book_info = {
        writer: writer,
        book_title: title,
        book_genre: genre,
        book_language: language,
        book_category: category,
        book_publisher: publisher,
        book_publishDate: publish_date,
        book_image_3: book_image,
        user_id: user_id
    };
    $http.post(insert_book_uri, book_info)
        .success(function (response) {
            console.log("Succed Inserting Book:");
            console.log(response);
        }) 
        .error(function (response) {
            console.log("Error on insertion: ");
            console.log(response);
            console.log(user_id);
        });
          };
       });
从现在起,所有的控制器都只用于从数据库中检索数据列表。我认为这是角度范围的问题

bookinsert.controller('lang_ctrl', function ($scope, $rootScope, $http) {
$http.post(lang_select_uri)
    .success(function (language_resp) {
        $rootScope.languages = language_resp;
        console.log("--Success--");
        console.log(language_resp);
    })
    .error(function () {
        console.log("error on language selection");
    });
});
下拉列表的图像如下所示
兄弟,你做错了。首先,您应该使用服务来使用$http为您保存或获取数据。控制器应仅用于控制视图。其次,您应该将language_resp分配给$scope变量,并使用该变量来反映。

是的,同意说应该创建服务,然后从那里调用web api。是的,我有服务,insert_book_uri是存储在其他文件中的服务url名称。那么,在没有控制器的情况下,我如何从数据库中获取数据列表呢?谢谢,我从一个控制器中发布了所有帖子,问题得到了解决:)(y)确切的问题是什么,您是否从api调用中获取数据?为了清晰起见,也要发布你的html