简体   繁体   English

Angular JS Ng开关的默认状态?

[英]Angular JS Ng-switch default state?

I'm really new to AngularJS but I wondered if anyone knew how to get a default ng-switch state working on the following plunkr, at the moment I can only get it to work on click, but if the user button is toggled then really the menu should show first time. 我真的是AngularJS的新手,但我想知道是否有人知道如何在以下plunkr上使用默认的ng-switch状态,目前我只能使其在单击时起作用,但是如果切换了用户按钮,那么菜单应该第一次显示。

http://plnkr.co/edit/bdu1T29cYe6mhb6OAFI8?p=preview http://plnkr.co/edit/bdu1T29cYe6mhb6OAFI8?p=preview

Any ideas? 有任何想法吗? ng-switch-default didn't seem to do the trick on the user component... ng-switch-default似乎对用户组件没有作用...

cheers 干杯

phil 菲尔

I'm not sure why you're using two separate variables when they're just configuration strings. 我不确定为什么当您只是配置字符串时使用两个单独的变量。 Use both the same and everything works fine. 同时使用,一切正常。

http://plnkr.co/edit/C28EwkuufYKs9Ipi0sA5?p=preview http://plnkr.co/edit/C28EwkuufYKs9Ipi0sA5?p=preview

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM