gpt4 book ai didi

angularjs - "ng-switch on"和 "ng-switch"的区别

转载 作者:行者123 更新时间:2023-12-03 22:31:19 28 4
gpt4 key购买 nike

我正在认真阅读 ngSwitch 的 AngularJS API 引用。当我谈到那部分时的指令:

place an expression on the on="..." attribute (or the ng-switch="..." attribute)



所以我当然想知道为什么有两种方法可以放置表达式,因为它们似乎以相同的方式工作。
<div ng-switch="expression">
<div ng-switch on="expression">

我认为有一个原因,但我现在没有找到任何东西。

Plunker 测试: http://plnkr.co/edit/VAq1t4744bnNC6RgZtEn?p=preview

最佳答案

没有区别。
您可以检查 ng-switch 指令的来源
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngSwitch.js

var watchExpr = attr.ngSwitch || attr.on

关于angularjs - "ng-switch on"和 "ng-switch"的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31559605/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com