Javascript 仅当选择/激活一个特定选项时,才显示带有提示的div。安格拉斯

Javascript 仅当选择/激活一个特定选项时,才显示带有提示的div。安格拉斯,javascript,angularjs,Javascript,Angularjs,我正在从事AngularJS项目,我有一个页面,其中注入了一个包含3个不同按钮的组件。我只需要在其中一个按钮被单击/激活/选中时显示此按钮的提示(不需要为另一个按钮显示任何内容)。我打赌这应该通过绑定来解决,但我不确定如何正确地做到这一点 你能给我个建议吗 这是我的密码 主页HTML: <ch-form-group title="Which notification should be sent?" header="Define the notific

我正在从事AngularJS项目,我有一个页面,其中注入了一个包含3个不同按钮的组件。我只需要在其中一个按钮被单击/激活/选中时显示此按钮的提示(不需要为另一个按钮显示任何内容)。我打赌这应该通过绑定来解决,但我不确定如何正确地做到这一点

你能给我个建议吗

这是我的密码

主页HTML:

<ch-form-group
  title="Which notification should be sent?"
  header="Define the notification that you want to send out to the qualifying customers.">

  <ch-toggle-blocks
    toggle-blocks="$ctrl.event_action_params"
    on-block-clicked="$ctrl.toggleEventAction(toggleBlock.key)">
  </ch-toggle-blocks>

// I want to display block here. So when inside the ch-toggle-blocks user // chose only specific button

  <notification-form
    channel-type="$ctrl.getChannelType()"
    channel="$ctrl.getChannel()">
  </notification-form>
</ch-form-group>

//我想在这里显示块。因此,当在ch切换块内时,用户//只选择特定按钮
切换块HTML

<div class="ch-toggle-blocks">
  <div
    data-hook="toggle-block-selector"
    class="toggle-block"
    ng-click="$ctrl.clickBlock(toggleBlock)"
    ng-class="{'current-toggle-block': toggleBlock.is_current}"
    ng-repeat="toggleBlock in $ctrl.toggleBlocks">

    <span
      data-hook="current-toggle-block-label"
      class="label label-cityhive"
      ng-if="toggleBlock.is_current">
      Current
    </span>

    <div class="toggle-block-icon">
      <i class="{{toggleBlock.icon}}"></i>
    </div>

    <div class="toggle-block-name">
      <span>{{toggleBlock.friendly_name}}</span>
    </div>
  </div>
</div>

现在的
{{toggleBlock.friendly_name}
chToggleBlocksComponent.js

'use strict';
angular.module('MyModule')
.component('chToggleBlocks',  {
  bindings: {
    toggleBlocks: '<',
    onBlockClicked: '&'
  },
  templateUrl: 'ch_toggle_blocks/chToggleBlocks.html',
  controller: function() {
    var ctrl = this;
    ctrl.clickBlock = function(toggleBlock) {
      this.onBlockClicked({toggleBlock: toggleBlock})
    }
  }
});
“严格使用”;
angular.module('MyModule')
.组件('chToggleBlocks'{
绑定:{

toggleBlocks:“难道你不能输入一个新的div并使用
ng if
来检查
toggleBlock.friendly_name='SMS'
?@DisplayNameismissing我想这样做,但有人要求我将其添加到父容器中。所以我需要从子容器中传递数据。我觉得解决问题的简单方法是使用
$scope.emit。”
$scope.on
从孩子向家长发送消息:当孩子设置为
SMS
时,
发出一个事件,在家长中用
on
捕捉它,然后设置一个值,如果
ng,该值将激活您的div