Jes*_*sse 9 angularjs angularjs-directive
这是一个错误还是某个地方的文档说不要在指令的名称中使用后缀"start"?只有'finish'指令才有效.
HTML:
<html ng-app="myApp">
...
<body>
<h2>Angular doesn't like the suffix 'start'</h2>
<div this-is-the-start="abc"></div>
<div this-is-the-finish="abc"></div>
</body>
...
</html>
Run Code Online (Sandbox Code Playgroud)
JS:
var myApp = angular.module('myApp',[]);
myApp.directive('thisIsTheFinish', function() {
return {
restrict: 'A',
template: 'finish'
}
});
myApp.directive('thisIsTheStart', function() {
return {
restrict: 'A',
template: 'start'
}
});
Run Code Online (Sandbox Code Playgroud)
我发布这个答案是为了让您可以将此问题标记为已回答。
正如 @calebboyd 指出的,这个问题在 GitHub 中被作为一个问题提出,并在“ 1.2.0rc1 spooky-giraffe (2013-08-13) ”的发行说明中添加有关重大更改的注释后关闭。这是Breaking Changes中 $compile 下的最后一点:
- 由于e46100f7,名称以“-start”或“-end”结尾的现有指令将停止工作。
此更改对于启用多元素指令是必要的。最好的解决方法是重命名现有指令,以便它们不以这些后缀结尾。
| 归档时间: |
|
| 查看次数: |
638 次 |
| 最近记录: |