Home >Web Front-end >JS Tutorial >Example code for calling methods in angular

Example code for calling methods in angular

零下一度
零下一度Original
2017-06-26 10:14:081354browse

Page:

Introduction file

'/select2.css','/select2-bootstrap.css','/select2.min.js','/ui-select2.js'

html:

<div ui-module=>
< 
  ui-select2= 
  ng-model=  // ng-model
= 
  ng-options=  //orgNameList是从接口里取出的数据,item.orgName是显示在option里的内容,item.orgCode就是ng-model的值
  ng-change=>    //每次点击option调用事件
</>
</div>

js:

$scope.selectedOrgName = ''; //ng-model的值
$scope.getInsuranceOrgList = function () {     var url = '/station/org/getInsuranceOrgList';     var params = {
         orgName:$scope.selectedOrgName //获取到值 作为入参传给接口
     };
     $http.post(url,params).success(function(res){
         $scope.orgNameList = res.respData.listObj;
     }).error(function(){});
};
$scope.getInsuranceOrgList();

The above is the detailed content of Example code for calling methods in angular. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn