【问题标题】:Angular route is not getting resolved in mozilla firefox在 Mozilla Firefox 中,Angular 路由没有得到解决
【发布时间】:2017-04-27 07:20:21
【问题描述】:

在我的 Angular 应用程序上工作时,我遇到了一个问题,即在 Google Chrome 中很容易解决的路线在 mozilla 中却无法解决。 每次我单击链接时,它都会将我重定向到默认 ('/') 路由 URL。

这是我的代码 sn-p 代码:-

.when('/profile/add/', {
    templateUrl: 'views/add-profile.html',
    controller: 'AddProfileCtrl'
})

下面是 HTML 代码

<a href="#/profile/add/ " class="btn-floating " title="Add a profile ">
      <i class="fa fa-plus "></i>
    </a>

虽然我可以通过 URL 地址栏轻松路由 URL,但不能通过 mozilla fireox 中的任何链接 href。

【问题讨论】:

  • 你可以为你的href发布html吗?
  • 这在其他浏览器中有效吗?即或野生动物园
  • 你是否使用过类似 $locationProvider.hashPrefix('!') 之类的 hasbang url?如果是,那么您必须将锚标记中的 url 更改为“#!/profile”
  • 否,没有使用任何 hashbang URL

标签: javascript angularjs ngroute route-provider


【解决方案1】:
 Example:
   app.config(function($stateProvider,$urlRouterProvider){ 
     $stateProvider
        .state("home",{
            url: "/home",
            templateUrl: './view/home.php',   
            controller: 'homeCtrl'
        });     
$urlRouterProvider.otherwise('home'); });   

你可以试试$stateProvider$urlRouterProvider....

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-14
    • 2012-05-12
    • 2019-06-28
    • 2014-11-07
    • 1970-01-01
    • 2020-10-14
    • 2013-09-30
    • 2019-07-18
    相关资源
    最近更新 更多