douyi0902 2016-05-17 10:04
浏览 26

PhoneGap在移动应用中动态创建页面

I have a PhoneGap mobile application that has a couple of predefined "html pages" (I used the double quotes, because they're not actual html files). I used the onsen-ui framework for it, so I can put all the "html" pages in ONE index.html file.

I create the pages like this:

<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>

As you can see, I have a Controller connected to this page, called LoginController which is defined in the main.js javascript file, which is the engine of the whole application. In order to do / show anything in the view, it has to have a controller and functions defined.

Is it possible, to dynamically add these ons-template>ons-page> elements to the index.html file, from php, so we can "update" the app, without actually changing anything on the application? Also, this would probably only work if the main.js file is also updated with a new controller, or should it be a generic one?

The app is used for showing info from a database, and we would like to add new "views" dynamically, which would show different data from the database.

  • 写回答

1条回答 默认 最新

  • drlnwji79147769 2016-05-17 16:44
    关注

    You might want to take a look at Microsoft's Code Push which is a plugin and server component designed to do update app content without an App Store update.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看