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

Example code for calling methods in angular

零下一度
Release: 2017-06-26 10:14:08
Original
1386 people have browsed it

Page:

Introduction file

'/select2.css','/select2-bootstrap.css','/select2.min.js','/ui-select2.js'
Copy after login

html:

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

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();
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template