【发布时间】:2017-01-06 19:00:58
【问题描述】:
我使用一个指令来格式化我的输入。现在我还想将它与 md-autcomplete 的输入一起使用。
我认为我已经阅读了在一个元素上使用两个具有隔离范围的指令是不可能的。我对吗? 否则我怎样才能访问 md-autocomplete 的输入?
提前谢谢你
更多信息:(角度材料 1.1 + 角度 1.5.*)
组件来源:
.component('payeeInformation', {
bindings: {...
},
templateUrl: 'payeeInformationTemplate',
controller:function(autocompleteService, $rootScope, $scope, $element, $compile, $document){
var ctrl = this;
this.genericAutocompleteSearch = autocompleteService.genericSearch;
addDirectiveToInputOfAutomplete('#my-input');
function addDirectiveToInputOfAutomplete(id){
var myAutoCompleteInput = angular.element($element[0].querySelector(id));
myAutoCompleteInput.attr("my-directive");
$compile(myAutoCompleteInput)($scope);
}
}
【问题讨论】:
-
您可以使用服务或将变量传入隔离范围以共享数据。这可能与您有关。 stackoverflow.com/questions/15343068/…
标签: angularjs angular-material