javascript - AngularJS: "isolate scope"还是 "isolated scope"?

标签 javascript angularjs angularjs-directive angularjs-scope

定义指令时,通常为它们提供一个独立的作用域,并且原型(prototype)上不会从任何父作用域继承。我一直很困惑这个术语应该是“隔离范围”还是“隔离范围”。

似乎大多数 AngularJS 官方文档都将其称为“隔离范围”。然而,官方文档中的某些地方确实将其称为“隔离范围”。当第一次阅读“隔离范围”时,我认为这是一个错字。官方文档中有很多错别字,所以这似乎是一个合乎逻辑的假设。

最佳答案

第一次介绍这个词in the directives guide它被称为隔离范围(实际上是粗体!):

What we want to be able to do is separate the scope inside a directive from the scope outside, and then map the outer scope to a directive's inner scope. We can do this by creating what we call an isolate scope.

稍后在同一文档中,它在以下上下文中将其称为“隔离范围”:

Besides making it possible to bind different data to the scope inside a directive, using an isolated scope has another effect.

我认为它们基本上是同义词,主要区别在于语言上。 isolate 一词是一个动词(隔离),而 isolated 是一个形容词,表达存在状态。这是我最好的理论!

顺便说一句,“隔离”一词在指令指南中仅使用了三次,这对我来说意味着作者可能主要希望将其称为隔离范围。

关于javascript - AngularJS: "isolate scope"还是 "isolated scope"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23957904/

相关文章:

javascript - 在 ie9 中加载 Google+button 脚本时,RPC 消息来源无效

javascript - 选择具有矩形或 Angular 嵌套数组元素

javascript - 使用 Angular UI 路由器 $stateProvider 在状态上声明主 Controller

angularjs - ng-ampere-debounce 似乎在 AngularJS 1.2 中停止工作

Javascript - 生成范围内的随机数,不包括某些数字

javascript - 在 AngularJS 1.2 中,如何为 ng-include 指定 Controller ?

javascript - 从 URL 添加 SVG 渲染黑色图像

javascript - 如何显示引导模式选项卡的内容?

jquery - 如何更改元素的 ng-model 属性(并使其工作)?

javascript - AngularJS:如何将常量对象绑定(bind)到指令