ng-model不使用md-menu angularjs材料

时间:2017-07-24 07:33:46

标签: javascript angularjs angular-material angular-ngmodel ng-controller

我正在使用角度材料的md菜单,在列表中我附加了一个带有ng-model的搜索框。但由于&md-menu-content'我无法访问ng-model。超出范围。我的代码在这里:

<div ng-controller="myController">
    <md-menu style="margin:auto 0;" md-position-mode="target-right target" md-offset="-40 0">
          <md-button ng-click="$mdMenu.open($event)" class="md-icon-button" aria-label="list">
            <i class="material-icons" md-menu-origin style="color:#006487;">&#xE8B6;</i>
          </md-button>
          <md-menu-content width="4">
              <md-menu-item>
                <input autofocus type="search" placeholder="Search in Line Items" id="table-search-inp" aria-label="search for line item" ng-model="searchLineItemText" ng-model-options="{ debounce: {default: 500} }" />
              </md-menu-item>
          </md-menu-content>
    </md-menu>
</div>

和控制器:

angular
    .module('app')
    .controller('myController', myController);
QuoteLineItemController.$inject = ['$scope', '$rootScope'];
function QuoteLineItemController($scope, $rootScope){
$scope.searchLineItemText = '';
$scope.$watch('searchLineItemText', function (newValue, oldValue) {
      if (newValue !== oldValue && newValue) {
        fetchSearchedLineItems(newValue);
      }
    });
};

请帮助

1 个答案:

答案 0 :(得分:1)

请添加角度材质依赖。

Try
  If thread IsNot Nothing Then
      tts.ve_ttsStop(hTtsInstance)
      ReleaseAudio()
      thread.Join()
      thread = Nothing
  End If
  thread = New Threading.Thread(AddressOf ExecuteTts)
  thread.Start()
Catch ex As Exception

End Try

QuoteLineItemController.$inject = ['$scope', '$rootScope'];

检查一下。 Plunker 您还需要添加库。

希望它会有所帮助。