If you use ng-cloak, and you do not load Angular.js in the head section of your HTML, you will need to add this to your CSS file, and ensure it loads at the top of your page:[ng\:cloak], [ng-cloak], .ng-cloak { display: none; }请注意,您只需在初始页面上使用这些指令.稍后引入的内容(例如,通过 ng-include、ng-view 等)将在浏览器呈现之前由 Angular 编译.Note that you only need to use these directives on your initial page. Content that is pulled in later (e.g., via ng-include, ng-view, etc.) will be compiled by Angular before the browser renders.除了 ng-show/hide 之外,有没有更好的方法来加载数据,其中只加载相关部分到 DOM 中. Is there a better way to load data other than ng-show / hide, in which only the relevant section is loaded into the DOM.ng-show/ng-hide 的一些替代方案是 ng-include、ng-switch 和(自 v1.1.5 起)ng-if:Some alternatives to ng-show/ng-hide are ng-include, ng-switch and (since v1.1.5) ng-if:<div ng-include src="someModelPropertySetToThePartialYouWantToLoadRightNow"></div>另请参阅 https://stackoverflow.com/a/12584774/215945 以获取 ng-switch 工作示例与 ng-include 一起使用.See also https://stackoverflow.com/a/12584774/215945 for an example of ng-switch working together with ng-include.请注意,ng-switch 和 ng-if 添加/删除 DOM 元素,而 ng-show/hide 仅更改 CSS(如果这对您很重要).Note that ng-switch and ng-if add/remove DOM elements, whereas ng-show/hide only alters the CSS (if that matters to you). 这篇关于替代 ng-show/-hide 或如何仅加载 DOM 的相关部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-01 16:43