- <!DOCTYPE html>
- <html lang="en" ng-app='myApp'>
- <head>
- <meta charset="UTF-8">
- <title>
- 继承
- </title>
- </head>
- <body>
- <div ng-controller='fatherCtrl'>
- <div ng-controller="sonCtrl">
- <h1>
- {{data}}
- </h1>
- </div>
- </div>
- <script type="text/javascript" src="../node_modules/angular/angular.min.js">
- </script>
- <script type="text/javascript">
- var myApp = angular.module("myApp", []);
- myApp.controller('fatherCtrl',
- function($scope, $rootScope) {
- $scope.data = "愚人节快乐!";
- }).controller("sonCtrl",
- function() {});
- </script>
- </body>
- </html>
来源: http://www.bubuko.com/infodetail-2005074.html