未捕获的错误:语法错误,无法识别的表达式:#/angularjs 和 jquery [英] Uncaught Error: Syntax error, unrecognized expression: #/ angularjs and jquery

查看:23
本文介绍了未捕获的错误:语法错误,无法识别的表达式:#/angularjs 和 jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我的页面加载时,我的控制台中都会显示以下错误.

Following error shown up in my console whenever my page loads.

未捕获的错误:语法错误,无法识别的表达式:#/about"

"Uncaught Error: Syntax error, unrecognized expression: #/about"

我的代码如下:

                <li class="active">
                    <a href="/">Home</a>
                </li>
                <li class="">
                    <a href="#/about" title="About Us">About</a>
                </li>
                <li class="">
                    <a href="#/pricing">Pricing</a>
                </li>

它显示了 的所有初始实例.最初,它首先显示 #/about,如果我删除 about us 选项卡,它将显示定价页面链接.

It shows for all initial instance of . Initially, it shows for #/about as it is first, If I remove about us tab it will show up for pricing page link.

这不是引导标签问题,这只是简单的导航

Its not bootstrap tab issue, This are simple navigation only

app.js 中的路由代码:

Routing Code in app.js:

$routeProvider.when('/', {
        templateUrl: 'partials/home.html'
    }).when('/account', {
        templateUrl: 'partials/account.html',
    }).when('/terms', {
        templateUrl: 'partials/terms.html'
    }).when('/about', {
        templateUrl: 'partials/about.html'
    }).otherwise({
        redirectTo: '/'
    });

我已经调试了它的引导程序问题,引导程序导航导致了这个问题:nav navbar-nav"对此的修复是 data-target="#" 但希望对此进行适当的解决

I have debug its issue of bootstrap, bootstrap nav causing this issue: "nav navbar-nav" fixes for this is data-target="#" but wants proper work around for this

推荐答案

这很可能是 Bootstrap 问题.尝试在您的链接上使用 data-target 属性

This is most probably a Bootstrap issue. Try using data-targetattribute on your links like this

<a href="#/about" data-target="#about" title="About Us">About</a>

这篇关于未捕获的错误:语法错误,无法识别的表达式:#/angularjs 和 jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆