我有我的html文件指令
<add />
<back />
Run Code Online (Sandbox Code Playgroud)
并且指令在表格上
.directive('add', ['$window', ...
Run Code Online (Sandbox Code Playgroud)
和
.directive('back', ['$window',
Run Code Online (Sandbox Code Playgroud)
这很好用.
如果我将指令更改为驼峰案例:
.directive('addPlayer', ['$window', ...
<add_player />
<back />
Run Code Online (Sandbox Code Playgroud)
和
<add:player />
<back />
Run Code Online (Sandbox Code Playgroud)
显示很好而
<add-player /> regular dash
<back />
Run Code Online (Sandbox Code Playgroud)
仅显示<add-player>,之后的所有内容均未显示.
有什么想法吗?
编辑:
我在这里得到了同样的行为
我有一个parent指令,其中包括两个子指令,first和second.我注意到只有第一个孩子被渲染.另外,如果我在第一个之前放置了一些任意的HTML标记,那么它都会被渲染,但是如果我把它们放在那之后那么它们就不会出现了.为什么是这样?
看到jsfiddle:
<!-- index.html -->
<div ng-app="myApp">
<my-parent-dir />
</div>
<!-- main.js -->
var app = angular.module("myApp", []);
app.directive("myParentDir", function() {
return {
restrict: 'E',
template: '<my-first-child /> <my-second-child />'
};
});
app.directive("myFirstChild", function() {
return {
restrict: 'E',
template: '<input type="text" placeholder="first">',
};
});
app.directive("mySecondChild", function() {
return {
restrict: 'E',
template: '<input type="text" placeholder="second">',
};
});
Run Code Online (Sandbox Code Playgroud)