내 페이지를 열면 메시지가 거품 이벤트처럼 출력됩니다. Message 2, Message 1. 그러나 터널 이벤트처럼 Message 1, Message 2 출력이 필요합니다. 왜 그렇게 된거야?각도 지시어 dom 빌드
<div by-global-size="width:100%;height:5%;">
<div by-parent-size="width:50%;height:30%;">
</div>
</div>
.directive("byGlobalSize", function() {
return {
link: function (scope, element, attributes) {
alert("Message 1");
},
restrict: "A",
scope: true
}
})
.directive("byParentSize", function() {
return {
link: function (scope, element, attributes) {
alert("Message 2");
},
restrict: "A",
scope:true
}
});
두 개의 지시문이 없어도 하나의 예입니다.
<div by-global-size="width:100%;height:5%;">
<div by-parent-size="width:50%;height:30%;">
<div by-parentChild-size="width:100%;height:5%;">
<div by-parentChildLittle-size="width:50%;height:30%;">
</div>
</div>
</div>
</div>
하나 더 HTML 예제. 부모부터 자식까지, 나는 dom 트리를 만들어야합니다. 계층 구조가 어떻게 든이있는 경우
Build result, inner -> outter,하지만 outter -> inner가 필요합니다. 그가 처음에 initliazed하지 않으면 내면의 크기 부모에 대해 어떻게 알게 될까요? ... –
미안하지만, 그것은 일이라고 생각합니다. 예 ... 예. 내가 너에게 말한 작품이라면 나는 밤에 프로젝트에서 노력할 것이다. 고마워. 나는 아주 빨리 대답한다. –
감사합니다. 사전 컴파일 작업이 필요합니다! –