angularjs指令范围默认值? [英] angularjs directive scope default value?

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

问题描述

什么是angularjs指令的默认值范围?

当然,它不是孤立的范围。这是真的还是faluse。

我找不到它是什么任何文件


解决方案

  

注意,默认情况下,指令不会创造新的范围 - 即默认为范围:假


的范围

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


  • 创建一个子范围与中典型继承范围:真正的

  • 创建与范围的隔离范围:{} ,那么你可以将某些属性的父作用域绑定'@','和;, '='(见<一href=\"http://stackoverflow.com/questions/14908133/what-is-the-difference-between-vs-and-in-angularjs\">this问题)。

  • 决定不创建一个新的范围,并使用与父范围:假(默认)

What is the default scope value of an angularjs directive?

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

I can't find any documentation on what it is

解决方案

"Note, by default, directives do not create new scope -- i.e., the default is scope: false"

from Understanding scopes.

Using the scope option in directive you can:

  • 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天全站免登陆