为什么我们需要NG-点击? [英] Why do we need ng-click?
本文介绍了为什么我们需要NG-点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
角应用使用 NG-点击()
属性,而不是在的onclick
事件。
Angular apps use the ng-click()
attribute rather than the the onclick
event.
这是为什么?
推荐答案
NG-点击持有角前pression。前角pressions在角范围,这势必给的背景下进行评估具有NG-点击属性或元素的祖先元素。
ng-click holds an angular expression. Angular expressions are evaluated in the context of an Angular scope, which is bound to the element having the ng-click attribute or an ancestor of that element.
该角的前pression语言不包括流量控制语句,不能声明变量或定义函数。这些限制意味着模板只能访问变量和函数运行由控制器或指令提供。
The Angular expression language doesn't include flow control statements and can't declare variables or define functions. These limitations mean templates can only access variables and run functions made available by a controller or directive.
这篇关于为什么我们需要NG-点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文