javascript - Angularjs ngSwitch with static nodes? -


how can have common nodes in ngswitch?

<div ng-controller="myctrl">     <div ng-repeat="widget in widgets" ng-switch="" on="widget.foo">      <h1>test</h1>      <p ng-switch-when="bar">lorem ipsum</p>      <small ng-switch-when="baz">lorem ipsum</small>      <footer>common footer</footer>     </div> </div> 

jsfiddle

the switch element renders last child of template. ideas if there better way?

try this:

<div ng-controller="myctrl">   <div ng-repeat="widget in widgets">       <h1>test</h1>       <div ng-switch on="widget.foo">           <p ng-switch-when="bar">lorem ipsum</p>           <small ng-switch-when="baz">lorem ipsum</small>       </div>       <footer>common footer</footer>   </div> </div> 

jsfiddle here.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -