::在Angular中的含义是什么? [英] What is the meaning of :: in Angular?

查看:238
本文介绍了::在Angular中的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ng-repeat 指令中看到了这个部分代码

I saw this partial code in an ng-repeat directive

<div ng-repeat="image in images">
    <img ng-src="{{::image.src}}"/>
</div>

不确定它是否与 ng-repeat 指令。

页面看起来是否相同,但我很好奇它是什么。

The page looks the same with or without it but I'm curious what it is.

推荐答案

此合成器用于一次性绑定在AngularJS中:

This synthax is use for one-time binding in AngularJS:


:: 开头的表达式被认为是一个时间表达。
如果表达式结果是
非未定义值(参见下面的数值稳定算法),则一次性表达式将停止重新计算,一旦它们稳定,
会在第一个摘要之后发生。 p>

An expression that starts with :: is considered a one-time expression. One-time expressions will stop recalculating once they are stable, which happens after the first digest if the expression result is a non-undefined value (see value stabilization algorithm below).

请参阅 相关的Plunker

这篇关于::在Angular中的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆