<div ng-controller="AjaxCtrl">
<h1>AJAX - Oriented</h1>
<div>
Country:
<select id="country" ng-model="country" ng-options="country for country in countries">
<option value=''>Select</option>
</select>
</div>
<div>
City: <select id="city" ng-disabled="!cities" ng-model="city" ng-options="city for city in cities"><option value=''>Select</option></select>
</div>
<div>
Suburb: <select id="suburb" ng-disabled="!suburbs" ng-model="suburb" ng-options="suburb for suburb in suburbs"><option value=''>Select</option></select>
</div>
</div>
<div ng-controller="StaticCtrl">
<h1>Static - Oriented</h1>
<p>This approach may be better when you have the entire dataset</p>
<div>
Country:
<select id="country" ng-model="cities" ng-options="country for (country, cities) in countries">
<option value=''>Select</option>
</select>
</div>
<div>
City: <select id="city" ng-disabled="!cities" ng-model="suburbs" ng-options="city for (city, suburbs) in cities"><option value=''>Select</option></select>
</div>
<div>
Suburb: <select id="suburb" ng-disabled="!suburbs" ng-model="suburb" ng-options="suburb for suburb in suburbs"><option value=''>Select</option></select>
</div>
</div>

js

function AjaxCtrl($scope) {
$scope.countries = ['usa', 'canada', 'mexico', 'france'];
$scope.$watch('country', function(newVal) {
if (newVal) $scope.cities = ['Los Angeles', 'San Francisco'];
});
$scope.$watch('city', function(newVal) {
if (newVal) $scope.suburbs = ['SOMA', 'Richmond', 'Sunset'];
});
} function StaticCtrl($scope) {
$scope.countries = {
'usa': {
'San Francisco': ['SOMA', 'Richmond', 'Sunset'],
'Los Angeles': ['Burbank', 'Hollywood']
},
'canada': {
'People dont live here': ['igloo', 'cave']
}
};
}

最新文章

  1. Visual Studio for Mac 简介
  2. SQL注入攻防入门详解(2)
  3. nginx(一)
  4. CC1310的RSSI值问题
  5. ubuntu使用root用户登录/切换root权限
  6. 对Oracle10g rac srvctl命令使用理解
  7. 当div自适应的高度超过预设的高度的时候出现滚动条的办法
  8. IO流-输入输出
  9. ASP.Net 类(CS)文件怎样获取Web应用程序的路径
  10. php获取网页中图片并保存到本地的代码
  11. NOIP2005 篝火晚会
  12. Swift_UILabel
  13. PAT (Advanced Level) 1082. Read Number in Chinese (25)
  14. Ubuntu下安装GTK环境
  15. 深度优先搜索(DFS)与广度优先搜索(BFS)的Java实现
  16. 【朝花夕拾】Android性能篇之(四)Apk打包
  17. C++程序设计方法2:基本语法2
  18. 2017-2018-2 java红茶第二周作业
  19. jQuery的遍历
  20. centos6下通用二进制格式安装MySQL过程

热门文章

  1. dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
  2. ACPI
  3. Oracle Day3 多行函数、多表查询
  4. 关于C/C++的四舍五入方向
  5. android通过代码判断手机是否root
  6. HDU 5769 Substring
  7. html元素中class属性值多个空格分格是什么意思?
  8. SharePoint 2010 应用url参数过滤列表视图数据(应用get办法过滤列表数据)
  9. 微信支付坑:url未注册
  10. textarea内容太多, 鼠标点击全部显示