html文件
<!DOCTYPE html>
<html >
<head>
<title>Angular JS Demo</title>
<script src="scripts/angular.min.js"></script>
<script src="scripts/Script_1.js"></script>
<meta charset="utf-8" />
</head>
<body>
<div ng-app="HelloWorldApp" ng-controller="HelloWorldController">
Message: {{ greeting }}
</div>
<div id="class2" ng-controller="HelloWorldController1">
Message: {{ message }}
</div>
</body>
</html>
Script_1.js
/// <reference path="angular.min.js" />
angular.module('HelloWorldApp', []).controller("HelloWorldController", function ($scope) {
$scope.greeting = "Hello World";
});
angular.module('HelloWorldApp1',[]).controller("HelloWorldController1",function ($scope) {
$scope.message = "Hello World";
});
angular.bootstrap(document.getElementById('class2'), ['HelloWorldApp1']);
The output is
Message: Hello World
Message: {{ message }}
虽然我使用了 angular.bootstrap(document.getElementById('class2',[HelloWorldApp1]); 为什么它不是引导程序。我是这个 anugular js 的新手,我是否缺少任何库?我被困在这里。请帮助我。
谢谢