gpt4 book ai didi

AngularJS指令: Are we not supposed to use the suffix "start"?

转载 作者:行者123 更新时间:2023-12-02 21:57:52 26 4
gpt4 key购买 nike

这是一个错误还是有文档表明不要在指令名称中使用后缀“start”?只有“完成”指令有效。

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>

JS:

var myApp = angular.module('myApp',[]);

myApp.directive('thisIsTheFinish', function() {
return {
restrict: 'A',
template: 'finish'
}
});

myApp.directive('thisIsTheStart', function() {
return {
restrict: 'A',
template: 'start'
}
});

实际代码: http://plnkr.co/edit/SrNncw?p=preview

最佳答案

我发布此答案是为了让您可以将此问题标记为已回答。

正如 @calebboyd 指出的那样,这被提出为 an issue in GitHub并在“1.2.0rc1 spooky-giraffe (2013-08-13)”的发行说明中添加有关重大更改的注释后关闭。这是 Breaking Changes 中 $compile 下的最后一点:

  • due to e46100f7, existing directives with name ending with "-start" or "-end" will stop working.

This change was necessary to enable multi-element directives. The best fix is to rename existing directives, so that they don't end with these suffixes.

关于AngularJS指令: Are we not supposed to use the suffix "start"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20749229/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com