index.html 2.18 KB
<html ng-app="myApp">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题</title>
    <link href="../spm_modules/bootstrap-css/1.0.0/bootstrap.css" rel="stylesheet">
    <link href="../spm_modules/xn-icon-common/1.0.5/iconfont.css" rel="stylesheet">
    <link href="../demo/base.css" rel="stylesheet">
    <link href="../directive/style.css" rel="stylesheet">

    <script type="text/javascript" src="../spm_modules/jquery/1.7.2/jquery.js"></script>
    <script type="text/javascript" src="../spm_modules/angular/1.3.9/angular.js"></script>
    <script type="text/javascript" src="../spm_modules/xn-underscore/1.0.0/underscore.js"></script>
    <script type="text/javascript" src="../spm_modules/angular-ui/1.0.0/bootstraptpls.js"></script>
    <script type="text/javascript" src="../spm_modules/xn-directive-form/1.0.1/directive/forms.js"></script>
    <script type="text/javascript" src="../directive/locations.js"></script>
    <style>
        .xn-province-city-box{
            border: 1px solid #dcdcdc;
            background: #fff;
            border-radius: 4px ;
        }
    </style>
</head>
<body ng-controller="MyController">
<div class="xn-width clearfix auto" style="width:1000px;">
    <div style="width:400px;">

        {{locationCity}}

        <div xn-foreign-province-city    ng-model="locationCity"  callback="callback(data)"  clear-method="clearMethod()"></div>

    </div>
</div>
</body>
<script type="text/javascript">
    var app=angular.module("myApp", ["ui.bootstrap","xn.directive.location.foreign"]);

    app.controller("MyController", ["$scope","$timeout", function($scope,$timeout){
        $timeout(function(){
            $scope.locationDistrict=
            {"provinceId":110000,
                "cityId":110100,
                "districtId":110102,
                "provinceName":"北京市",
                "cityName":"北京市",
                "districtName":"西城区"}
        },1000);


        $scope.callback=function (data) {
            console.log("选择数据完整版");
            console.log(data);
        };
        $scope.clearMethod=function () {
            console.log("清空数据");
        }
    }]);
</script>
</html>