Reputation: 25691
Code
<input type="text" ng-model="person.name" />
<div ng-switch on="person.name"></div>
<p ng-switch-default>And the winner is</p>
<h1 ng-switch-when="Ari">{{ person.name }}</h1>
what's wrong? I got Error: [$compile:ctreq]
, but removing these 4 lines all goes ok.
I got this example on 'ng-book' (a very BAD book)
Upvotes: 0
Views: 103
Reputation: 191779
ng-switch
element needs to wrap the ng-switch-on
and ng-switch-default
directives (the latter ones require the former).
<input type="text" ng-model="person.name" />
<div ng-switch on="person.name">
<p ng-switch-default>And the winner is</p>
<h1 ng-switch-when="Ari">{{ person.name }}</h1>
</div>
Upvotes: 1