Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未捕获错误:语法错误,无法识别的表达式:#/Jquery_Javascript_Jquery_Html_Angularjs - Fatal编程技术网

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

Javascript 未捕获错误:语法错误,无法识别的表达式:#/Jquery,javascript,jquery,html,angularjs,Javascript,Jquery,Html,Angularjs,嗨,我从jquery得到这个错误。 在索引中。我有一个href <li><a href="/#/Locations">Locations</a></li> 这是堆栈: Uncaught Error: Syntax error, unrecognized expression: #/Locations error @ jquery.min.js:4 gt @ jquery.min.js:4 kt @ jquery.min.js:4 ot @ jqu

嗨,我从jquery得到这个错误。 在索引中。我有一个href

<li><a href="/#/Locations">Locations</a></li>
这是堆栈:

Uncaught Error: Syntax error, unrecognized expression: #/Locations
error @ jquery.min.js:4
gt @ jquery.min.js:4
kt @ jquery.min.js:4
ot @ jquery.min.js:4
x.fn.extend.find @ jquery.min.js:5
x.fn.x.init @ jquery.min.js:4
x @ jquery.min.js:4
i.getCurrentSection @ jquery.singlePageNav.min.js:8
i.checkPosition @ jquery.singlePageNav.min.js:8
i.init @ jquery.singlePageNav.min.js:8
(anonymous function) @ jquery.singlePageNav.min.js:8
x.extend.each @ jquery.min.js:4
x.fn.x.each @ jquery.min.js:4
e.fn.singlePageNav @ jquery.singlePageNav.min.js:8
(anonymous function) @ custom.js:34
l @ jquery.min.js:4
c.fireWith @ jquery.min.js:4
x.extend.ready @ jquery.min.js:4
S @ jquery.min.js:4
我有位置控制器的js文件,可能会出现错误:

var groupLocationByCityFromController

角度。模块('storeApp')。控制器('LocationController', 函数($rootScope,$scope,$http){


如何解决此错误

您可以为上下文发布更多代码吗?我不认为错误在您发布的内容中可能是您可以告诉我一些特定的原因我有很多代码,我认为这就是问题所在。错误的完整堆栈跟踪会很好。看起来您引用的是jquery错误,但我看不到jquerypostedI已经上传了堆栈跟踪。您在代码中的某个地方调用jQuery函数了吗?它似乎在试图解析表达式
#/Locationsot.
Uncaught Error: Syntax error, unrecognized expression: #/Locations
error @ jquery.min.js:4
gt @ jquery.min.js:4
kt @ jquery.min.js:4
ot @ jquery.min.js:4
x.fn.extend.find @ jquery.min.js:5
x.fn.x.init @ jquery.min.js:4
x @ jquery.min.js:4
i.getCurrentSection @ jquery.singlePageNav.min.js:8
i.checkPosition @ jquery.singlePageNav.min.js:8
i.init @ jquery.singlePageNav.min.js:8
(anonymous function) @ jquery.singlePageNav.min.js:8
x.extend.each @ jquery.min.js:4
x.fn.x.each @ jquery.min.js:4
e.fn.singlePageNav @ jquery.singlePageNav.min.js:8
(anonymous function) @ custom.js:34
l @ jquery.min.js:4
c.fireWith @ jquery.min.js:4
x.extend.ready @ jquery.min.js:4
S @ jquery.min.js:4
    //Get all locations from server
    $http({
        method: 'GET',
        url: '/LocationJSON'
    }).then(function success(res){
        $scope.locations = res.data.JSON;
    }, function err(){
        console.log("Error the the LocationJSON");
    });

    //Edit page
    $scope.getEdit = function(location){
        $rootScope.locationToEdit = location;
        if ($rootScope.locationToEdit != undefined && $rootScope.locationToEdit != null) {
         window.location.href = '/#/Locations/editLocation';
        }
        else
            console.log("Error in getEdit");
    }

    //Update after edit
    $scope.updateLocation = function(location) {
        console.log("Update:" + location);
        $http({
            method: "POST",
            url: '/location',
            data: location
        }).then (function success(res) {
            console.log("success in updating:" + location);
            window.location.href = '/#/Locations';
        }, function err(res) {
            console.log("Error in updating:" + location);
        });
    }

    //delete location by id
    $scope.deleteLocation = function(locationId){
        $http({
            method : "DELETE",
            url : '/deleteLocation' + "=" + locationId
        }).then (function success(res){
            console.log("Success in Deleting Location id: " + locationId);
            $scope.locations = res.data.JSON;
        },function err (res){
            console.log("Error in deleting location id: " + locationId);
        });
    }

    //Group by city
    $scope.groupLocationByCity = function() {
        $http({
            method : "GET",
            url: '/locationByCity'
        }).then (function success(res) {
            groupLocationByCityFromController=res.data;
            $rootScope.groupLocationByCity = res.data;
            window.location.href = '/#/Locations/GroupLocationByCity';
        }, function err(res){
            console.log("Error with location group by");
            window.location.href = '/#/Locations';
        });
    }

    //load create page
    $scope.getCreate = function () {
        window.location.href = '/#/Locations/LocationsCreate';
    }

    //create new location
    $scope.createLocation = function (newLocation) {
        $http ({
            method : "PUT",
            url : '/createNewLocation',
            data :newLocation
        }).then (function success(res) {
            console.log('create new location');
            window.locations.href = '/#/Locations';
        },function err (res){
            console.log("Error creating new Location");
        })
    }

});