【问题标题】:URL error in ionic framework离子框架中的 URL 错误
【发布时间】:2014-11-16 16:58:52
【问题描述】:

我正在使用 ionicframework 和 cordova 开发一个 android 应用程序。我想根据某些条件打开 url 但它不起作用,这是代码。

if("notify".equals(message)){
//its not loading
super.loadUrl("file:///android_asset/www/index.html/announcements");
}else{

//this works fine
super.loadUrl("file:///android_asset/www/index.html/");
}

app.js

.state('app.announcements', {
      url: "/announcements",
      views: {
        'menuContent' :{
          templateUrl: "templates/announcements.html",
          controller:'announcementCtrl'
        }
      }
    })

if条件执行时会产生错误 net:ERR_FILE_NOT_FOUND(file:///android_asset/www/index.html/announcements)

【问题讨论】:

    标签: android angularjs cordova ionic-framework


    【解决方案1】:

    我假设您在设计中使用单页应用程序结构。所以只需输入 /announcements 即可 不工作。假设您的菜单网址看起来像这样

    <a href="#/appmain/announcements"> 这将起作用

    file:///android_asset/www/index.html#/appmain/announcements
    

    【讨论】:

      猜你喜欢
      • 2016-10-29
      • 2018-02-06
      • 1970-01-01
      • 2019-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多