ng-switch没有按预期切换
问题描述:
我似乎在这里缺少一些基本的东西ng-switch
。这是一个jsFiddle。ng-switch没有按预期切换
我试图打开profile_type
但我无法。
<div ng-controller="MyCtrl">
<div ng-repeat="result in results">
<div ng-switch="profile_type">
<div ng-switch-when="PatientProfile">{{ result.name }}</div>
<div ng-switch-when="DoctorProfile">{{ result.name }}</div>
</div>
</div
</div>
$scope.results = [
{profile_type: "PatientProfile", name: "Steve Patient"},
{profile_type: "DoctorProfile", name: "Joe Doctor"},
]
答
有遗漏,找到这一行并改变它像这样:
<div ng-switch="result.profile_type">