为什么取代AngularJS pcated德$ P $? [英] Why is replace deprecated in AngularJS?

查看:151
本文介绍了为什么取代AngularJS pcated德$ P $?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据<一个href=\"https://$c$c.angularjs.org/1.3.0-beta.11/docs/api/ng/service/%24compile#-replace-de$p$pcated-will-be-removed-in-next-major-release-\">the API文档,指令替换属性德precated,所以在未来,所有的指令都与当前的默认行为更换:假

According to the API docs, directives' replace attribute is deprecated, so in the future, all directives will behave with the current default of replace: false.

这消除开发者的替换元素指令的元素,没有明显的替代此功能的能力。

This removes developers' ability to replace an element directive's element, with no apparent replacement for this functionality.

有关的元素指示如何使用和不使用更换工作的范例请参见这普拉克:真正的

See this plunk for an example of how element directives work with and without replace: true.

这是为什么有用的属性是没有替代pcated德$ P $?

Why is this useful attribute being deprecated with no replacement?

推荐答案

更新

一位合作者曾表示它不会被删除,但已知的错误将不会被固定。
<一href=\"https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb#commitcomment-8124407\">https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb#commitcomment-8124407

One of the collaborators has said it won't be removed, but known bugs will not be fixed. https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb#commitcomment-8124407

原始

下面是这种变化的承诺:
<一href=\"https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb\">https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb

Here is the commit of this change: https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb

替换标志定义指示,替换元素
  他们是在将下一个主要版本棱角去掉。
  此功能有困难的语义(属性例如如何合并)
  并导致相比有什么能解决更多的问题。另外,与
  WebComponents这是正常的DOM中的自定义元素。

The replace flag for defining directives that replace the element that they are on will be removed in the next major angular version. This feature has difficult semantics (e.g. how attributes are merged) and leads to more problems compared to what it solves. Also, with WebComponents it is normal to have custom elements in the DOM.

这听起来对我来说,它是一个复杂的利益VS组合,以保持支持。

It sounds to me like its a combination of complexity vs benefit to maintain support.

和明显的原因之一是因为他们$ P $开发正在使用它pfered语义正确的标记被注入,从而取代了自定义的指令标记。

And apparently one reason dev were using it because they prefered semantically correct markup to be injected , thus replacing the custom directive tag.

阅读注释低了下去该链接,显然很多人希望它留下来。

Read the comments lower down on that link and apparently many people want it to stay.

这篇关于为什么取代AngularJS pcated德$ P $?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆