aztack / AngularJS-translation

Chinese translation of book AngularJS by Brad Green & Shyam Sesbadri
49 stars 15 forks source link

HowTo - How to surround text with tag conditionally in AngularJS? #8

Open aztack opened 11 years ago

aztack commented 11 years ago

How to surround text with tag conditionally in AngularJS?

<div ng-switch="!!link">
    <a ng-href="{{link}}" ng-switch-when="true">linked</a>
    <span ng-switch-when="false">notlinked</span>
</div>

credit Umur Kontacı