Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 使用Java后端在Angular中填充组合框_Angularjs_Ajax - Fatal编程技术网

Angularjs 使用Java后端在Angular中填充组合框

Angularjs 使用Java后端在Angular中填充组合框,angularjs,ajax,Angularjs,Ajax,事情如标题所述 作用{ var app=角度。模块'sbi',[]; app.controller'PanelController',函数{ 这个.tab=1; this.selectTab=函数设置选项卡{ this.tab=setTab; }; this.isSelected=functioncheckTab{ 返回this.tab==checkTab; }; }; app.controller'MyCtrl',函数$scope,$compile{ "严格使用",; $scope.data=

事情如标题所述

作用{ var app=角度。模块'sbi',[]; app.controller'PanelController',函数{ 这个.tab=1; this.selectTab=函数设置选项卡{ this.tab=setTab; }; this.isSelected=functioncheckTab{ 返回this.tab==checkTab; }; }; app.controller'MyCtrl',函数$scope,$compile{ "严格使用",; $scope.data={name:}; $scope.reset=函数{ $scope.data.name=; $scope.data.codeSub=; $scope.data.cognSub=; $scope.data.codfis=; $scope.data.drpdownvalue=; $scope.form.$setPristine; } }; 表格,td{边框宽度:2px;边框折叠:折叠;填充:15px;颜色:000000;文本对齐:居中;} table.pos_fixed1{位置:相对;顶部:30px;左侧:10px;} 代码子安装程序 斯塔托 -Seleziona- Nome分安装商 Cognome子安装程序 鳕鱼鱼鳞 塞尔卡 普利西 利苏尔蒂 :

德塔格里奥 还不够熟练

函数DoListenerStato有它的查询,它可以在Java中使用 但是组合框没有被填充。 我是否正确使用了ajax?如果是,我能做什么? 如果可能的话,我更愿意继续使用ajax来完成这项工作。

你能试试$http.get而不是$http.ajax吗

在Controller.js文件中:


既然您的ng模型中已经有了数据。****,这应该可以解决这个问题。

$。ajax是jQuery。当您可以使用Angular自己的ajax$http时,为什么要混合使用呢?这是一个工作,我不制定规则。AngularJS通过提供自己的事件处理循环来修改正常的JavaScript流。这将JavaScript分为经典和AngularJS执行上下文。只有在AngularJS执行上下文中应用的操作才会受益于AngularJS数据绑定、异常处理、属性监视等。使用与AngularJS执行上下文集成的。在AngularJS中,使用或指令填充组合框。有关更多信息,请参阅gularJS使用或指令填充组合框。有关更多信息,请参阅。
app.controller('DdController', function($scope, $compile) {
    'use strict';

    var loadUrl = contextName+"/subinstaller/inserimento/dettaglio.do?methodName=doListenerStato";
    $.ajax({
        async: false,
        url : loadUrl,
        type: "GET",
        data: data, 
        dataType: 'json',
        cache: false,
        complete: function(){
            _show_(false,'waitPanel');
        },
        success : function (data, stato) {
            $('#service').empty()
            for(var i = 0; i < data.length; i++) {
                $("#service").append($('<option value="'+data[i].code+'">'+data[i].descr+'</option>'));                 
            }
            $('#service').trigger("chosen:updated");
        },
        error : function (richiesta, stato, errori) {
            _show_(false,'waitPanel');
            alert("error caricaServices");
        }
    });
    });


})();
$scope.data = {};
$http.get(loadUrl).then(function (response){
     $scope.data = response.data;
     //success callback
}, function (response) {
    //error callback
});