AngularJS UI引导" BTN-广播QUOT;指令不起作用 [英] AngularJS UI Bootstrap "btn-radio" directive doesn't work

查看:149
本文介绍了AngularJS UI引导" BTN-广播QUOT;指令不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现场演示

任何人都可以解释为什么前两个按钮组工作,但第三个不?

Could anyone explain why the first two button groups work, but the third one doesn't?

<div class="btn-group">
  <button ng-repeat="company in companies" 
          class="btn" 
          ng-model="radioModel.id" 
          btn-radio="company.id">
    {{company.name}}
  </button>
</div>

<div class="btn-group">
  <button class="btn btn-two" 
          ng-model="radioModel.id"
          btn-radio="2">
    two
  </button>
  <button class="btn btn-two" 
          ng-model="radioModel.id"
          btn-radio="3">
    three
  </button>
</div>

<div class="btn-group">
  <button ng-repeat="company in companies" 
          class="btn btn-{{ company.name }}" 
          ng-model="radioModel.id" 
          btn-radio="company.id">
    {{company.name}}
  </button>
</div>

$scope.companies = [ { id: 2, name: "two"}, {id: 3, name: "three"} ];
$scope.radioModel = { id: 3 };

本例使用AngularUI引导0.5.0。如果我将其更改为0.3.0,一切正常。

This example uses AngularUI Bootstrap 0.5.0. If I change it to 0.3.0, everything works as expected.

推荐答案

使用纳克级。在的字符串插值是时髦的。

Use ng-class. The string interpolation in class is funky.

ng-class="'btn btn-' + company.name" 

这篇关于AngularJS UI引导&QUOT; BTN-广播QUOT;指令不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆