0
ディレクティブを作成しましたが、ディレクティブは実行されません。私はこの問題は明白なものであると確信しているが、私はそれを見ることができない。カスタムモジュールにディレクティブを登録するには
<!DOCTYPE html>
<html lang="en-US">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body>
<div ng-app="app">
<responsive-parent>xxx</responsive-parent>
</div>
<script>
angular.module("mrpmorris.responsive-parent", [])
.directive("responsive-parent", [
"$window", "$timeout",
function ($window, $timeout) {
console.log("**** THIS IS NEVER REACHED ****");
return new mrpmorris.responsiveParent.Directive($window, $timeout);
}
]);
var mrpmorris;
(function (mrpmorris) {
var responsiveParent;
(function (responsiveParent) {
var Directive = (function() {
function Directive($window, $timeout) {
var _this = this;
this.$window = $window;
this.$timeout = $timeout;
this.restrict = "E";
this.template = "<h1>It works</h1>";
this.replace = true;
}
return Directive;
}());
responsiveParent.Directive = Directive;
})(responsiveParent = mrpmorris.responsiveParent || (mrpmorris.responsiveParent = {}));
})(mrpmorris || (mrpmorris = {}));
angular.module("app", ["mrpmorris.responsive-parent"]);
</script>
</body>
</html>
ありがとうございます。私は何かばかげたことを知っていた:) –