xPages 和 AngularJS - 标签属性中的命名空间前缀导致 DDE 中出现错误

发布于 01-08 12:51 字数 583 浏览 4 评论 0原文

我想在我的 xPages 应用程序中使用 AngularJS http://www.angularjs.org 但我发现了一个奇怪的问题Angular 使用的语法与 xPages 冲突。 Angular 添加了特殊的标签属性,这些属性是 Angular 引擎/编译器的命令。通常,Angular 使用具有“ng”命名空间的属性。例如,

<div ng:app="" ng:controller="">
... content here ...
</div>

当我将这些属性放入 xPages 中时,编辑器将其作为错误引发,因为没有定义这样的“ng”命名空间。当我在 xPage 标记中定义此命名空间时,DDE 中没有错误,但 Domino 从属性名称中删除了此“ng”前缀,因此事情不起作用,我在浏览器中得到此输出:

<div app="" controller="">
... content here ...
</div>

有没有办法,如何解决这个问题吗?

I would like to use AngularJS http://www.angularjs.org in my xPages app but I found a strange problem that syntaxt, that Angular is using, colides with xPages. Angular adds special tag attributes that are commands for angular engine/compiler. Typicly Angular uses attributes with 'ng' namespace. e.g.

<div ng:app="" ng:controller="">
... content here ...
</div>

When I put these attributes into xPages, editor raises it as an error because there is no such 'ng' namespace defined. The when I define this namespace in xPage tag, there is no error in DDE but Domino removes this 'ng' prefix from attributes names, so things do not work and I'm getting this outpput in browser:

<div app="" controller="">
... content here ...
</div>

Is there a way, how to solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迷你仙2025-01-15 12:51:32

xpages 源代码生成器正在删除前缀,如果您有 8.5.3,则可以执行此操作。

<xp:panel tagName="div">
    <xp:this.attrs>
        <xp:attr name="ng:app" value="test"></xp:attr>
        <xp:attr name="ng:controller" value="test"></xp:attr>
    </xp:this.attrs>
</xp:panel>

如果您还没有使用 8.5.3,则必须执行以下操作:

<xp:text escape="false">
    <xp:this.value><![CDATA[#{javascript:return "<div ng:controller='test' ng:app='test' >"; }]]></xp:this.value>
</xp:text>
    <xp:text escape="false">
    <xp:this.value><![CDATA[#{javascript:return "</div>"; }]]></xp:this.value>
</xp:text>

the xpages source code generator is removing the prefixes, if you have 8.5.3, you can do this.

<xp:panel tagName="div">
    <xp:this.attrs>
        <xp:attr name="ng:app" value="test"></xp:attr>
        <xp:attr name="ng:controller" value="test"></xp:attr>
    </xp:this.attrs>
</xp:panel>

If you are not on 8.5.3 yet, you would have to do something like this:

<xp:text escape="false">
    <xp:this.value><![CDATA[#{javascript:return "<div ng:controller='test' ng:app='test' >"; }]]></xp:this.value>
</xp:text>
    <xp:text escape="false">
    <xp:this.value><![CDATA[#{javascript:return "</div>"; }]]></xp:this.value>
</xp:text>
对不⑦2025-01-15 12:51:32

来自 xpage 圣经:

“要使用新的 ui 组件,您需要扩展当前的 xpages 控制标签集”。为此,请在 xsp.config 文件中指定一个新标签名称作为组件定义的一部分”

<faces-config>
 <faces-config-extension>
   <namespace-uri>...</namespace-uri>
   <default-prefix>...</default-prefix>
 </faces-config-extension>
</faces-config>

我从未这样做过添加这样的库但这也许有帮助

From the xpage bible:

"To use the new ui component , you need to extend the current set of xpages control tags'. To do this specify a new tag name as part of the component definition in an xsp.config file"

<faces-config>
 <faces-config-extension>
   <namespace-uri>...</namespace-uri>
   <default-prefix>...</default-prefix>
 </faces-config-extension>
</faces-config>

I never did add such a library but maybe this helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文