简体   繁体   English

离子框架中的URL错误

[英]URL error in ionic framework

I am developing an android application using ionicframework and cordova.I want open url based on some conditions but its not working,here is the code. 我正在使用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 app.js

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

when the if condition executes it will generate the error net:ERR_FILE_NOT_FOUND(file:///android_asset/www/index.html/announcements) if条件执行时将生成错误net:ERR_FILE_NOT_FOUND(file:///android_asset/www/index.html/announcements)

I assume you are using single page application structure in your design.so just put /announcements is not working.Suppose your menu url's is look like this 我假设您在设计中使用的是单页应用程序结构,因此仅放/announcements不起作用。假设您的菜单URL如下所示

<a href="#/appmain/announcements"> and this wil work <a href="#/appmain/announcements"> ,这将奏效

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM