gpt4 book ai didi

javascript - 确定调用了哪些 AngularJS 函数

转载 作者:行者123 更新时间:2023-12-03 01:05:52 24 4
gpt4 key购买 nike

假设我们有来自 w3schools 的以下代码:

<script>
var app = angular.module("myShoppingList", []);
app.controller("myCtrl", function($scope) {
$scope.products = ["Milk", "Bread", "Cheese"];
});
</script>

<div ng-app="myShoppingList" ng-controller="myCtrl">
<ul>
<li ng-repeat="x in products">{{x}}</li>
</ul>
</div>

我想确切地知道从一开始就调用了哪些函数(来自 angular.js 代码)。有没有办法做到这一点?换句话说,如果我没有HTML文件,我可以重现angular.js的效果吗?

我已经使用了 Chrome 开发工具,但它没有解决我的问题。

最佳答案

来自文档:

Automatic Initialization

AngularJS initializes automatically upon DOMContentLoaded event or when the angular.js script is evaluated if at that time document.readyState is set to 'complete'. At this point AngularJS looks for the ngApp directive which designates your application root. If the ngApp directive is found then AngularJS will:

  • load the module associated with the directive.
  • create the application injector
  • compile the DOM treating the ngApp directive as the root of the compilation. This allows you to tell it to treat only a portion of the DOM as an AngularJS application.

有关详细信息,请参阅AngularJS Developer Guide - Bootstrap - Automatic Initilization .

关于javascript - 确定调用了哪些 AngularJS 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52413476/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com