Home > Web Front-end > JS Tutorial > body text

angularJs secondary linkage

不言
Release: 2018-04-04 11:47:03
Original
1353 people have browsed it

The content of this article is angularJs secondary linkage. Now I share it with everyone. Friends in need can also refer to this content.


<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="js/angular.min.js" ></script>
		<script type="text/javascript" src="js/lib/js/angular/angular.js" ></script>
		<script>
			var app=angular.module("app",[]);
app.controller("global",[&#39;$scope&#39;,function($scope){
    $scope.g=[
        {text:"亚洲",nat:[
            {text:"中国",cities:[{text:"北京"}]},
            {text:"巴林",cities:[]},
            {text:"韩国",cities:[{text:"首尔"}]},
            {text:"黎巴嫩",cities:[]},
            {text:"东帝汶",cities:[]},
            {text:"尼泊尔",cities:[]},
            {text:"泰国",cities:[{text:"曼谷"}]},
            {text:"巴基斯坦",cities:[{text:"伊斯兰堡"}]}
        ]},
        {text:"欧洲",nat:[
            {text:"德国",cities:[]},
            {text:"英国",cities:[]}
        ]},
        {text:"北美洲"},
        {text:"南美洲"},
        {text:"非洲"},
        {text:"大洋洲"},
        {text:"南极洲"}
    ]
}]);
		</script>
	</head>
	<body>
		
		<p ng-app="app" ng-controller="global">
    <select ng-model="ihg" ng-options="ihg.text for ihg in g">
        <option value="">-- 洲际 --</option>
    </select>
    <select ng-if="ihg.nat" ng-model="nat" ng-options="nat.text for nat in ihg.nat">
        <option value="">-- 国家 --</option>
    </select>
    <select ng-if="nat.cities" ng-model="city" ng-options="city.text for city in nat.cities">
        <option value="">-- 城市 --</option>
    </select>
</p>
	</body>
</html>
Copy after login

Related recommendations :

AngularJS front-end js framework

In-depth analysis of AngularJS dependency injection principle



The above is the detailed content of angularJs secondary linkage. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template