ng-district
v1.0.1
Published
省市县三级联动
Downloads
2
Readme
ng-district
省市县三级联动
npm install --save ng-district
Demo
<ng-district
prov="../data/province.json"
city="../data/district.json"
dist="../data/couty.json"
prov-param="ProvinceId"
city-param="cityId"
result="districtInfo"
>
</ng-district>
<script src="ng-district.js"></script>
<script>
var app = app.module('app', ['ng.district'])
app.controller(function ($scope){
$scope.districtInfo = {};
// if a deep watch needed
$scope.$watch('districtInfo', function (newVal, oldVal) {
// do something
}, true);
});
</script>
参数说明
prov
省级行政区数据接口city
地级行政区数据接口dist
县级行政区数据接口prov-param
传给地、县级行政区接口的省份id字段名称, 默认为ProvinceId
city-param
传给县级行政区接口的城市id字段名称, 默认为cityId
result
行政区联动指令所在scope
中用来绑定数据的对象, 该指令会为该对象加上[ province | city | district ]Id
三个字段