gpt4 book ai didi

jquery - 页面加载后如何初始化 angularjs ng-app

转载 作者:行者123 更新时间:2023-12-01 07:45:08 24 4
gpt4 key购买 nike

从 jquery ajax 加载内容,其中包含 ng-app=""和其他指令。但它不会初始化。现在,如何初始化 angularJS 初始化页面加载后添加的 ng-app。

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
<div ng-app="" class="uk-width-3-5 uk-grid">
<input class="uk-width-4-5" ng-model="classe" placeholder="Nivel academico..." type="range" min="1" max="13" value="14" name="classe" required>
<b class="uk-width-1-5">{{classe}}ª Classe</b>
</div>

最佳答案

我认为你应该使用 angular.bootstrap。当您的 DOM 准备好并且所有内容都已附加时调用它。

angular.bootstrap(document, ['myApp']);

这将在文档上启动 Angular,就像上面有 ng-app 一样。您可以将其引导到您想要的任何元素。

希望这有帮助

关于jquery - 页面加载后如何初始化 angularjs ng-app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39570075/

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