首页 > 代码库 > Angularjs[5] - 多个控制器(待补充)

Angularjs[5] - 多个控制器(待补充)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <div ng-app>
        <div ng-controller="firstController">
            <input type="text" value="" ng-model="name">
            <div ng-controller="secondController">
                <input type="text" value="" ng-model="name">
            </div>
        </div>
    </div>
    <script type="text/javascript" src="app/index.js"></script>
<script type="text/javascript" src="../../vendor/angular/angularjs.js"></script>
</body>
</html>
var firstController = function ($scope) {
    $scope.name = ‘Alrale‘;
    $scope.age = ‘20‘;
}
var secondController = function ($scope) {
    
}

 

Angularjs[5] - 多个控制器(待补充)