我似乎错过了ng-switch
的基本内容。这是一个jsFiddle。
我试图启用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"},
]
答案 0 :(得分:4)
缺少某些东西,找到这一行并改变它:
<div ng-switch="result.profile_type">