UI5不适用于AngularJS [英] UI5 doesn't work with AngularJS

查看:36
本文介绍了UI5不适用于AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用AngularJS编写的单页应用程序.我需要在其中放置与声明性支持一起使用的UI5文本字段(出于测试目的).

I have a single page application written in AngularJS. I need to put a UI5 text field there (for testing purposes) that I am using with Declarative Support.

我有2个文件:

  1. index.html
  2. sap.html.

在我的index.html中,我有< div class ="mainView" ng-view></div> 然后将sap.html注入index.html.

In my index.html I have <div class="mainView" ng-view></div> and there I inject sap.html into the index.html.

当我在index.html中写此行时,我看到sap文本字段:

when I write this line in my index.html I see the sap text field:

<div data-sap-ui-type='sap.ui.commons.TextField' id='message' class='my-button' data-value='Hello World'></div>

但是,当我将此代码放入sap.html中时,浏览器中不会显示文本字段.

However, when I put this code in sap.html the text field isn't being shown in the browser.

当我在chrome F12源代码模式下查看时-我发现与UI5相关的标签已被评估到index.html中的文本框中.在sap.html(通过ng-view注入的角度"页面)中不会发生这种情况-我只是看到标签按原样"-在注入页面中的DOM未被评估.

When I look in the chrome F12 source mode - I see that the UI5 related tag has been evaluted into textbox in the index.html. This doesn't happen in the sap.html (the "injected by angular ng-view" page) - I just see the tag "as is" - the DOM in the injected page was not evaluted.

  • 为什么会这样?AngularJS引导程序还是生命周期干扰树液boostrap?
  • 有什么办法可以解决?

我需要使用AngularJS,因为它是现有应用程序的一部分.对我来说,重新编写应用程序是不可行的.

I need to use AngularJS because it is a part of an existing app. A re-write of the app is not an option for me.

谢谢

推荐答案

我从没遇到过这种情况,并且真的不认为这是一个好的解决方案(但这是我的观点).我想知道为什么您希望UI5能够动态了解AngularJS注入标记?

I never came across this scenario and really do not consider this a good solution (but this is my opinion). I wonder why do you expect UI5 to be aware of AngularJS injecting markup dynamically?

但是,文档显示了如何编译动态加载的标记.显然,AngularJS提供了一个事件来监听ngView内容的重新加载,也许可以在那里触发编译.

However, the documentation shows an example of how to compile dynamically loaded markup. Obviously AngularJS provides an event to listen to reloads of ngView content, maybe it is possible to trigger the compliation there.

这篇关于UI5不适用于AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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