HTML:
<section>
<!-- <div ng-controller="Ctrl"> -->
<div nt-attr-dir></div>
</section>
的script.js
angular.module('docsSimpleDirective', [])
.directive('ntAttrDir', function factory() {
var directiveDefinitionObject = {
template: "<div> Test </div>",
replace:false,
restrict:"A"
};
return directiveDefinitionObject;
});
所以预期的结果是html代码应该看起来像
<section>
<!-- <div ng-controller="Ctrl"> -->
<div nt-attr-dir><div> Test </div></div>
</section>
但它总是如下所示
<section>
<!-- <div ng-controller="Ctrl"> -->
<div nt-attr-dir></div>
</section>
我缺少什么,以便不显示测试。
答案 0 :(得分:0)
ng-app
指令:<html ng-app="docsSimpleDirective">