<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body ng-app="myapp" ng-controller="myctrl">
<select ng-init="select_provice=provices[0]" ng-model="select_provice" ng-options="x.provice for x in provices"
ng-click="changeProvice()" >
</select>
<select ng-init="select_city=select_provice.city[0]" ng-model="select_city" ng-options="c for c in select_provice.city">
</select><br /><br />
<input type="button" id="" value="获取省" ng-click="getProvice()" />
<input type="button" id="" value="获取市" ng-click="getCity()" />
<script type="text/javascript">
var app = angular.module("myapp", []);
app.controller("myctrl", function($scope) {
$scope.provices=[
{"provice":"河北","city":["石家庄","秦皇岛"]},
{"provice":"河南","city":["洛阳","郑州"]},
{"provice":"辽宁","city":["沈阳","大连"]}];
$scope.changeProvice=function(){
$scope.select_city=$scope.select_provice.city[0];
}
$scope.getProvice=function(){
var p=$scope.select_provice.provice;
alert(p);
}
$scope.getCity=function(){
var c=$scope.select_city;
alert(c);
}
});
</script>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body ng-app="myapp" ng-controller="myctrl">
<select ng-init="select_provice=provices[0]" ng-model="select_provice" ng-options="x.provice for x in provices"
ng-click="changeProvice()" >
</select>
<select ng-init="select_city=select_provice.city[0]" ng-model="select_city" ng-options="c for c in select_provice.city">
</select><br /><br />
<input type="button" id="" value="获取省" ng-click="getProvice()" />
<input type="button" id="" value="获取市" ng-click="getCity()" />
<script type="text/javascript">
var app = angular.module("myapp", []);
app.controller("myctrl", function($scope) {
$scope.provices=[
{"provice":"河北","city":["石家庄","秦皇岛"]},
{"provice":"河南","city":["洛阳","郑州"]},
{"provice":"辽宁","city":["沈阳","大连"]}];
$scope.changeProvice=function(){
$scope.select_city=$scope.select_provice.city[0];
}
$scope.getProvice=function(){
var p=$scope.select_provice.provice;
alert(p);
}
$scope.getCity=function(){
var c=$scope.select_city;
alert(c);
}
});
</script>
</body>
</html>