角度表达式评估等于

时间:2013-09-20 05:49:45

标签: angularjs

我想做这样的事情。

<h3 ng-show="{{mode == 'create'}}">Create Vacancy</h3>
<h3 ng-show="{{mode == 'edit'}}">Edit this Vacancy</h3>

$scope.mode是“创建”还是“编辑”。

我该怎么做?我正在尝试的任何工作都没有。

1 个答案:

答案 0 :(得分:22)

ng-show本身就是表达式,所以不要使用插值文本。将您的代码更新为:

<h3 ng-show="mode == 'create'">Create Vacancy</h3>
<h3 ng-show="mode == 'edit'">Edit this Vacancy</h3>
相关问题