0
ディレクティブのテンプレートを囲むために使用できるディレクティブのオプションパラメータを指定する必要があります。角度:パラメータのマークアップの1つにディレクティブのテンプレートを埋め込む
angular
.module('test')
.directive('dropdownField', dropDownFn);
function dropDownDirective Fn(termParameters, restService) {
return {
scope: {
'markup' : "=?"
},
bindToController: true,
controllerAs: "vm",
templateUrl: "dropdown.tpl.html",
controller: function ($scope, $element, $attrs) { ... }
}
}
HTMLは次のようになります:
<dropdown-field
markup="<div class='thisIsTheSurroundingMarkup'></div>"
></dropdown-field>
またはこの:
Inside the controller:
$scope.thisIsTheSurroundingMarkupFromTheController = "<div class='thisIsTheSurroundingMarkup'></div>";
<dropdown-field>
{{ thisIsTheSurroundingMarkupFromTheController }}
</dropdown-field>
両/以下の結果を生成する必要があります:これは、基本的な私が持っているものの一例である
<div class='thisIsTheSurroundingMarkup'>
<select ...>...</select> <-- this comes from dropdown.tpl.html
</div>
1つはngTranscludeで、しかし、私はどのようにわからない。誰かが私を正しい方向に向けることができますか?どうもありがとう!