我有一个PhoneGap移动应用程序,它有几个预定义的“html页面”(我使用双引号,因为它们不是真正的html文件)。 我使用了onsen-ui框架,因此我可以将所有“html”页面放在一个index.html文件中。
我创建了这样的页面:
<ons-template id="login.html">
<ons-page ng-controller="LoginController" id="login">
<ons-toolbar>
<div class="center">Log In</div>
</ons-toolbar>
<div class="login-form">
<input type="text" class="text-input--underbar" placeholder="Username" ng-model="email">
<input type="password" class="text-input--underbar" placeholder="Password" ng-model="password">
<br><br>
<ons-button modifier="large" class="login-button" ng-click="checkLogin(email,password)" > Log In</ons-button>
</div>
</ons-page>
</ons-template>
正如您所看到的,我有一个 Controller 连接到此页面,称为LoginController,它在main.js javascript文件中定义,该文件是整个应用程序的引擎。为了在视图中执行/显示任何内容,它必须定义控制器和函数。
是否有可能从php动态地将这些 ons-template&gt; ons-page&gt; 元素添加到index.html文件中,这样我们就可以“更新”应用,而无需实际更改任何内容在申请?此外,如果main.js文件也使用新控制器更新,或者它应该是通用控制器,那么<em>可能只能工作吗?
该应用程序用于显示数据库中的信息,我们希望动态添加新的“视图”,这将显示数据库中的不同数据。