상황 요소를 포장 :
나는 그것이 템플릿에 요소의 랩하는 속성 지시자가있다.AngularJS와 : 각도 속성 지시자와 함께 사용자 지정 서식에
app.directive("myCustomInput", function(){
return{
restrict: "A",
replace: true,
scope:{},
transclude: "element",
template: "<div class='input-wrap'>"+
"<div ng-transclude></div>"+
"<i class='glyphicon glyphicon-chevron-down'></i>"+
"</div>"
}
});
그리고처럼 사용 : 여기있다
가<input my-custom-input ng-model="data.input" type="text" />
문제 :
ng-model
이
여기
가 plunker
재미있는 것은 이것이 당신이 [다른 질문] 제공 대답이었다 (http://stackoverflow.com/questions/25295882/angular-attribute-directive-that입니다 -wraps-its-element/27648516 # 27648516)? :) – PSL
:)) 정확하게! 나는 내 자신의 문제가 발생할 때까지 실제로 그 대답에서 말한 것을 사용하고있었습니다! –