가 Plunker 라이브를 시도하십시오 - http://plnkr.co/edit/js7WOhjgKwUeElrdNwv0?p=preview 나는이 문제를 해결하십시오 작업 할 수있는 방법각도 지시어는 다른 지시를 "중단"(NG-필요 NG 장애인)
? Plunker와 아래의 예제와는 달리, 내가 작업하고있는 지시어는 고립 된 범위를 필요로한다. (적어도 현재의 구현은 하나를 사용하고 나는 그것을 다시 작성하지 않을 것이다.)
<!DOCTYPE html>
<html>
<head>
<script data-require="[email protected]*" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script data-require="[email protected]*" data-semver="1.1.5" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js"></script>
<script>
var app = angular.module("MyApp",[]);
app.directive("myDirective", function(){
return {
//scope:{},
link: function(){}
};
});
</script>
<style>
.ng-invalid{
border: 1px solid red;
}
</style>
</head>
<body ng-app="MyApp">
<h1>My Directive</h1>
<p>Test the checkbox below then uncomment //scope:{} and try again.</p>
<input type="checkbox" ng-model="isActive" />
<input type="text" ng-model="foo"
my-directive
ng-disabled="!isActive"
ng-required="isActive" />
</body>
</html>
안부, 한스
감사합니다. Aron. 귀하의 답변은 작동 할뿐만 아니라 지시가 더 잘 적용되는 방법을 이해하는 데 도움이되었습니다. 고맙습니다. – hcvst