AngularJS指令范围的默认值是什么? [英] What is the default for AngularJS directive scope?

查看:75
本文介绍了AngularJS指令范围的默认值是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AngularJS指令的默认作用域值是什么?

What is the default scope value of an AngularJS directive?

当然,它不是孤立的作用域.这是对还是错.

Of course, it is not isolated scope. It is true or false.

我找不到有关它的任何文档.

I can't find any documentation on what it is.

推荐答案

注意,默认情况下,伪指令不会创建新的作用域-即默认值为scope: false"

来自了解范围.

使用指令中的scope选项,您可以:

Using the scope option in directive you can:

  • 创建原型化为scope: true
  • 的子范围
  • 使用scope: {}创建隔离范围,然后可以使用'@', '&', '='将某些属性绑定到父范围(请参阅
  • create a child scope prototypically inherited with scope: true
  • create an isolated scope with scope: {} then you can bind some property to parent scopes with '@', '&', '=' (see this question).
  • decide to not create a new scope and use parent with scope: false (default).

这篇关于AngularJS指令范围的默认值是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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