如何使用AngularJS /离子作为骨干/科尔多瓦项目的一部分? [英] How to use AngularJS/Ionic as part of Backbone/Cordova project?

查看:102
本文介绍了如何使用AngularJS /离子作为骨干/科尔多瓦项目的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来AngularJS /离子,所以我要求你的帮助,给我们一些想法的如何添加AngularJS /离子以骨干项目的一部分

I am new to AngularJS/Ionic so I am asking for your helps to give us some ideas about how to add AngularJS/Ionic to part of Backbone project.

我们手头上有一个项目,该项目是基于在科尔多瓦骨干框架构建。现在,我们正在寻找在AngularJS做我们的工作的一部分。我们正在考虑是建立在骨干新页面与requireJS并实施什么用AngularJS显现。

We have a project on hand which is built based on Backbone framework in Cordova. Now we are looking for doing part of our jobs in AngularJS. What we are thinking is to create new pages in Backbone with requireJS and implement what to show by AngularJS.

例如,我们创建由init一个新的页面,呈现在骨干网和在返回的HTML,它有角的东西,如:

For example, we create a new page by init and render it in Backbone and in the html returned, it has Angular stuff such as:

<div >
    <p>My first expression: {{ 5 + 5 }}</p>
</div>

我们安装在科尔多瓦的顶层离子和它们导入的index.html:

We installs Ionic on top of Cordova and import them in index.html with:

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <script src="lib/ionic/js/ionic.bundle.js"></script>
    <script src="js/main.js"></script>

在Chrome的调试模式,角就可以使用,但HTML仍然解析为纯文本

In the Chrome debug mode, angular is ready to use but the html is still parsed as plain text as

My first expression: {{ 5 + 5 }}


一个想到的是角是进口的,但它是在主视图,我们创建了新的一页是通过点击主视图按钮另一种观点。科尔多瓦取代把它放在当前视图它仍然显示相同的网页客户端顶部的主视图。因此,在这种情况下,AngularJS不知道它应该在哪里努力。我试着HTML是在Chrome调试模式渲染之后触发角,它显示$范围为未定义。


One thought is angular is imported but it is on the main view, the new page we created is another view by clicking a button on main view. Cordova replace the main view by put it on top of current view which is still show the 'same' page to client. So in this case, AngularJS does not know where should it work on. I tried to trigger angular after html is rendered in Chrome debug mode, it shows $scope as undefined.

从意见架构上看任何想法,从编码方面,从演示,从什么都非常欢迎。即使你相信它是基于两种不同的框架是不可能的,请在下面留下你的理由。大AP preciates!

Any ideas from architecture point of views, from coding side, from demo, from anything are very welcomed. Even if you believe it is impossible based on two different frameworks, please leave your reasons below. Great appreciates!

推荐答案

我自己找到了答案。

是的。它可以添加AngularJS /离子到存在的骨干/科尔多瓦项目。我发现了一个很好的例子吧, https://gist.github.com/geddski/5571990

Yes. It can add AngularJS/Ionic to an existed Backbone/Cordova project. I found a good example for it, https://gist.github.com/geddski/5571990.

我们的想法是仍然使用骨干创建一个页面,但页面里面,它是在它的上面实施意见AngularJS。离子1.0可以直接在科尔多瓦工程安装。

The idea is to still using Backbone to create a page, but inside the page, it is AngularJS on top of it to implement views. Ionic 1.0 can install in Cordova project directly.

希望这可以帮助。如果您有任何疑问或任何更新的信息,请随时回复。谢谢你。

Hope this could help. If you have any questions or any updated information, please feel free to reply. Thank you.

这篇关于如何使用AngularJS /离子作为骨干/科尔多瓦项目的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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