Angular UI 按钮无法正常工作

Angular UI buttons not working properly

我正在使用 Angular UI,我已经加载了依赖项并获得了模块 'ui.bootstrap''

正在尝试 imitate this。这就是我正在尝试的:

<div class="form-group">
    <div class="btn-group">
      <label ng-model="reactionType" uib-btn-radio="left" uncheckable class="btn btn-sucess">Alegría</label>
      <label ng-model="reactionType" uib-btn-radio="middle" uncheckable class="btn btn-default">Tristeza</label>
      <label ng-model="reactionType" uib-btn-radio="right" uncheckable class="btn btn-default">Tristeza</label>
    </div>
  </div>

得到了

因此左侧的第一个按钮始终处于选中状态,而其他按钮似乎无法选中。我错过了什么?

它非常微妙,但您在 uib-btn-radio 值中遗漏了单引号。

ie: "'left'"

修改后的代码如下:

<label ng-model="reactionType" uib-btn-radio="'left'" uncheckable class="btn btn-default">Alegría</label>
<label ng-model="reactionType" uib-btn-radio="'middle'" uncheckable class="btn btn-default">Tristeza</label>
<label ng-model="reactionType" uib-btn-radio="'right'" uncheckable class="btn btn-default">Tristeza</label>