<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>angular.js</title> <script type="text/javascript" src="./js/script.js"></script> <!--<script type="text/javascript" src="./js/angular-1.3.0.js"></script> <script type="text/javascript" src="./js/app.js"></script>--> </head> <body> <div ng-controller="WelcomeCtrl"> <p ng-bind="greeting.text"></p> </div> </body> <script type="text/javascript"> var script= $script; script.path("js/"); script('angular-1.3.0',function () { script('app',function () { angular.bootstrap(document,['demo']); }); }) </script> </html>
區別就是在異步加載中須要手動啓動angular,同事也要去掉 ng-app指令 不然會啓動失敗(仍是能夠手動啓動的),提示 沒有的模型javascript
//手動啓動angular angular.bootstrap(document,['demo']);