AngularJS及其使用美元变量 [英] AngularJS and its use of Dollar Variables
问题描述
有谁知道,如果在angularJS使用美元的方法和变量背后的推理是指导angularJS以避免检查这些值时,消化是怎么回事?所以,如果角遇到 $范围。$值
和 $ scope.value
,那么就会避免检查前因为它是在其变量名称以美元字符pfixed $ p $?
Does anyone know if the reasoning behind the use of dollar methods and variables in angularJS is to instruct angularJS to avoid checking those values when a digestion is going on? So, if angular comes across $scope.$value
and $scope.value
, then it will avoid checking the former since it's prefixed with a dollar character in its variable name?
推荐答案
有角几次忽略美元符号pfixed变量$ P $:
There are a few times Angular ignores variables prefixed with the dollar sign:
- 在<一个href=\"http://stackoverflow.com/questions/12648543/angularjs-and-its-use-of-dollar-variables#comment19433906_12648794\">Schumli's评论以下,其中JSON过滤器不会输出它们
-
在使用
{{}}
指令,角不会显示的嵌套的$
变量。例如,这只是显示了可见
属性。
- In Schumli's comment below, where json filters will not output them
When using the
{{ }}
directive, angular will not show nested$
variables. For example this only displays thevisible
property.
<div ng-init="n = { visible: 'foo', $ignore: 'bar' };">{{ n }}</div>
此外一个范围对象上添加一个明确的守望者时,与此对象的前导美元符号更改属性将不会触发观察者。请参见此更新的小提琴。
angular.equals()
忽略与pfixed键$ P $ $
。
这篇关于AngularJS及其使用美元变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!