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

查看:29
本文介绍了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"

来自理解范围.

在指令中使用范围选项,您可以:

Using the scope option in directive you can:

  • 创建一个子作用域原型继承scope: true
  • 使用 scope: {} 创建一个隔离的作用域,然后您可以使用 '@', '&', '=' 将某些属性绑定到父作用域(请参阅这个问题).
  • 决定不创建新范围并使用带有 scope: false(默认值)的父级.
  • 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天全站免登陆