2016-04-26 116 views
0

即时通讯面临我的离子应用程序的问题。我通过离子服务在网页浏览器上编写了整个应用程序。现在我想在Android设备上发布我的应用程序。离子安卓按钮不起作用

在网络中一切正常,但当我尝试启动我的android 4.3或5.5设备上的应用程序时,我没有任何反应,当我点击登录页面上的登录按钮。

这是我的登录模板:

<ion-view view-title="Anmelden" name="login-view"> 
    <ion-content class="padding"> 
     <div class="list list-inset"> 
      <label class="item item-input"> 
       <input type="text" placeholder="Username" ng-model="data.username"> 
      </label> 
      <label class="item item-input"> 
       <input type="password" placeholder="Passwort" ng-model="data.password"> 
      </label> 
     </div> 
     <button class="button button-block button-positive" ng-click="login(data)">Login</button> 
    </ion-content> 
</ion-view> 

我的路由(简体),它在我的app.js run函数后:

.config(function ($stateProvider, $urlRouterProvider, USER_ROLES) { 
    $stateProvider 
    .state('login', { 
    url: '/login', 
    templateUrl: 'templates/login.html', 
    controller: 'LoginCtrl' 
    }) 
    $urlRouterProvider.otherwise('/login'); 
}) 

我LoginCtrl的实际功能没有得到所以我假设我的模板不知道怎么连接它的路由。 该按钮只是显示死了,当你按下它时(没有发生任何反应)(也监视我的网络服务器上的传入http请求)。

我也尝试从ng-click改为on-tap。 有人能帮助我吗?非常感谢。

问候

回答

4

index.html添加到您的标题(请参阅http://content-security-policy.com/

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> 

而且你应该添加cordova-plugin-whitelist到项目中(参见https://github.com/apache/cordova-plugin-whitelist

cordova plugin add cordova-plugin-whitelist 

,并添加以下请联系您的​​3210

<access origin="*" /> 
<allow-intent href="*" /> 
+0

完美:-)就是这样。 – Timon