Coder Social home page Coder Social logo

angular-city-select's Introduction

AngularJS 省份城市联动

类似淘宝收货地址的所在地。过于仓促,暂时先这样子吧。

升级日志

v1.0.1

  1. 升级地址库为最新县及县以上行政区划代码(截止2013年8月31日),去掉自治区等字眼。
  2. 修复县区选中值累计问题。
  3. 新增邮政编码。

使用说明

添加angular.city.select模块到你的应用。

angular.module('myApp', ['angular.city.select', ...]);

html标记

<city-select ng-model="item.city"></city-select>

ng-model必须是一个带有*.city对象,另一方面,对于初始化,支持两种方式分别是:

// 按名称顺序,当未找到时中止。
$scope.item = {
    city: [ '安徽', '芜湖', '弋江' ]
};

// 按区域ID
$scope.item.city = '340203';

onCitySelected 事件

app.controller('myController', ['$scope', function($scope){

	$scope.$on('onCitySelected', function(event, item) {
        // item.cn[] 数组,和面板数量相对应。
        // item.id 区域ID
        // item.zip 邮政编码
	}
	
}]);

bower install

$ bower install angular-city-select --save

angular-city-select's People

Contributors

cipchk avatar mo-gong avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.