Angularjs ngRoute is not working in firefox [duplicate]

最后都变了- 提交于 2019-12-23 06:16:15

问题


<script>
        var app = angular.module('singlepageapp', ['ngRoute'])

        app.config(['$routeProvider', function ($routeProvider) {
            $routeProvider

                .when('/About', {
                    templateUrl: 'DistrictMaps/About.aspx',
                })
            .when('/Ch', {
                templateUrl: 'DistrictMaps/Ch.aspx',

            })

        }]);
        app.run(function ($rootScope) {
            $rootScope.$on('$viewContentLoaded', function () {
                $('html, body').animate({
                    scrollTop: $("#bottom").offset().top,
                }, 2000);
            });
        });
    </script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js">
<body ng-app="singlepageapp">

    <div id="svgdiv" style="text-align: left;">
        <svg
            preserveAspectRatio='xMinYMin'
            viewBox="0 0 850 700"
            width="850"
            height="700"
            id="Main_svg"
            version="1.1">
            <g
                inkscape:groupmode="layer"
                id="layer3"
                inkscape:label="innercircle">

                <a href="#/About" id="94650dac-e76b-4dec-8fcc-2d40dff7d95d" class="District" title="EastGodavari">
                    <path

                        d="m 457.26279,328.23151 -0.18711,1.35614 0.2804,1.16955 0.14073,1.44995 -0.56132,1.02936 -0.82253,0.94834 2.05818,-0.13327 0.92968,-0.73031 2.39029,-0.53094 0.79641,-0.86304 2.39029,-1.32788 1.59388,-0.19937 1.65945,-1.06241 2.12482,-1.52724 2.45692,-0.99578 1.65998,0.19937 1.79272,0.73031 2.52302,-1.26178 1.06188,-0.46484 1.39451,-1.26125 1.85935,-0.99577 1.39398,-0.0666 0.86358,-0.99577 1.79272,-0.73031 0.7964,0.53094 0.73031,-1.26178 1.99209,-0.66367 1.06241,-0.66421 1.46061,-1.26124 1.39451,0.3321 0.92914,-0.99631 2.05872,-0.53094 1.65945,-0.99577 0.33211,-0.92968 2.19145,-0.53147 0.13273,-0.79641 1.52672,-0.59757 1.32788,0.53094 1.59388,0.3982 0.99578,-1.26124 0.46483,-1.19515 0.99578,-0.46484 0.46484,-0.7303 -0.19937,-0.92968 -0.46431,-0.53094 0.66368,-1.46061 0.19937,-0.92968 -0.19937,-1.06241 -1.39452,0 -0.33157,-0.3982 0.59758,-1.26178 0.7303,-0.0661 1.32788,-0.266 0.59758,-0.66367 0.53093,-1.65999 0.0666,-1.06241 -0.46484,-1.19514 -0.59757,-0.53094 -1.12851,-0.66421 -0.26601,-1.19514 0.39874,-1.39451 0.73031,-0.59758 0.92967,-0.59757 0.19884,-0.86304 0,-1.52671 0.26547,-0.66421 0.19937,-1.39451 -0.39821,-1.12851 1.19515,-0.92968 0.3982,-1.52725 -0.26547,-1.19514 -0.13273,-1.59335 0.53094,-0.99578 -0.46484,-1.26178 -0.66367,-1.26124 0.13273,-0.53147 -0.99578,-0.99578 -0.79694,-0.73031 -0.19937,-1.12904 -1.46061,-0.99578 -0.79694,-0.3982 -0.59757,1.12851 -0.13274,0.86304 -0.13273,1.39452 0.73031,1.06241 0.39873,0.86304 0.92914,0.79694 0.59758,0.26547 0,1.52725 -0.59758,0.59757 0.0666,0.86304 0.19937,0.99578 -0.13327,1.12904 -0.92914,-0.13274 -1.52725,-0.6642 -1.79272,-0.0661 -0.86304,-0.46484 -0.99631,-0.99631 -0.59757,-0.86304 0.0666,-1.12851 1.32788,-0.13274 0.66421,-0.86357 0.13273,-1.39398 -0.26547,-1.12904 0.59758,-0.79641 -0.0666,-0.99631 -0.79694,-0.92914 0.266,-1.46115 0.92915,-1.26125 1.46061,-1.65998 1.46115,-0.73031 0.7303,-1.59334 0.53094,-1.39452 2.98786,-1.52724 1.39452,-1.65999 1.19514,-0.92914 0.99578,-0.92967 2.09923,-0.43925 1.12051,-1.21701 0.99312,-1.05654 1.05654,-0.89663 1.02456,-0.99257 1.79325,-0.44832 1.02457,-1.08906 2.11362,-1.47287 -1.06028,-0.98139 -1.45368,-0.64608 -1.29216,0.16152 0,-0.96912 0.24201,-0.80814 0.56559,-1.21113 0.0805,-0.88863 0.96966,0 1.04961,-0.96913 0.96913,-0.8076 -0.48456,-1.53471 -0.80761,-1.13117 0.081,-1.29217 0.32304,-0.8076 0.8076,-1.05015 0.88863,-1.04962 1.29217,-0.96965 0.96912,-1.93825 -1.53471,-1.29216 0,-1.05015 -1.04962,-0.8076 -0.56559,-1.2927 -0.96912,-0.96912 -1.53471,0.8076 -1.53471,0.40407 -0.72711,0.64608 -1.29216,-0.16152 -0.40354,-0.96912 -0.16152,-1.21167 -1.05015,-0.88863 -0.40406,1.13117 -0.32305,0.72658 -0.96912,0.72711 -0.081,0.72711 0.081,1.21113 -0.88863,1.05015 -1.29216,0.24255 -1.53471,-0.32304 -0.64608,-0.88863 -0.96913,-0.24255 -0.40406,-1.13064 0,-1.21167 -1.37319,0.24255 -0.64609,0.72711 -0.72657,-0.16152 -0.64662,-1.37319 -0.88809,0.64608 0,-1.21167 0,-1.69623 1.04961,-0.88863 0.56559,-0.56506 0,-1.69623 -0.56559,-0.88863 -1.77672,0.64608 -1.21167,-1.13064 -0.72711,-1.21167 -0.96912,-0.72657 -1.37319,-0.32305 -0.96912,0.32305 -0.32304,-1.21167 -0.8881,-0.56559 -1.2927,0.24254 -0.72711,0.56559 -0.96912,1.45369 -1.69623,0.64608 -1.37266,-0.32304 -1.37319,-1.37319 -0.72711,-1.69623 -0.8076,-0.8881 -1.29216,-0.16152 -1.93878,0.16152 -0.96912,0.96912 -0.24255,0.48456 -1.29216,0.0805 -0.96913,0.64661 -0.56558,0.80761 -0.64609,0.88809 -0.88809,-1.04962 -0.24255,-1.37319 0.56559,-1.6152 1.04962,-1.93878 0.7271,-1.6152 0,-1.77726 -0.88862,-1.04962 -0.0805,-1.05015 -1.13064,-0.64608 -0.40407,-0.96965 -1.77726,-0.32304 -1.45368,1.05014 -0.24201,1.13065 -1.21167,0.40407 -1.21167,-0.16152 -1.37319,0 -1.37319,-0.48457 -0.96913,0.80761 -0.96912,-0.40407 0.0805,-1.13064 1.13118,-1.45369 1.21114,-1.53471 1.53471,-0.56559 1.21167,-1.13064 0.88863,-0.64608 2.01927,-0.24255 1.13064,-1.53418 1.05015,-1.37319 0.88863,-0.72711 0.48456,-1.05015 0.24201,-1.6152 0.88863,-0.64608 0.40354,-1.29216 -0.16152,-1.61574 0.081,-0.96912 -1.45368,-0.88863 -0.32357,-1.77673 -1.04962,-1.61574 -0.8076,-0.96912 -1.05921,0.0517 -0.42273,0.65354 -0.4611,0.38435 -1.19142,0.1919 -0.88383,0.46111 -0.96059,0.5384 -0.76869,0.15353 -1.1525,0.11514 -0.76869,0.42272 -0.30758,0.88384 -0.69193,0 -1.26817,0.15405 -0.69139,0.26867 -0.38435,0.65355 -0.38434,0.34596 -1.07574,-0.0773 -1.07627,0.11568 -1.03735,0.61463 -0.88383,1.07627 -0.53841,0.42272 -0.61463,0.26867 -1.15303,1.03789 -0.38434,0.49949 0.76815,0.39927 0.51921,0.22762 0.6173,0.77935 0.48723,0.58478 0.68179,0.45471 0.68233,0.48669 0.0325,0.68233 -0.35769,0.6818 -0.42219,0.45471 -0.55173,0.68233 -0.55226,0.35716 -1.07201,0.19457 -0.97392,0.13007 -0.84491,0.0325 -0.77935,-0.0976 -0.77935,0.6173 -0.38968,0.61729 -0.6818,0.58425 -0.68233,0.38967 -0.22708,0.71485 0,0.6818 -0.32518,0.35716 -0.38967,0.58477 -0.81187,0.0325 -1.03949,0.32464 -1.16902,0.19511 -1.10399,-0.32518 -1.07201,0.35769 -0.74683,0.25961 -0.0976,0.55226 -0.42219,0.81187 -0.81187,0.68179 -0.84438,0.26014 -0.77935,-0.0975 -0.56079,0.57625 0.1935,1.35773 -0.29052,1.35773 -0.87317,1.8423 -0.77562,1.45475 -0.58211,1.84282 -1.64826,0.6786 -0.19403,1.35773 0,1.45475 0.87263,0.77615 -0.77562,1.06668 -0.29105,1.26071 -0.58212,1.16369 0.097,1.74581 -0.097,1.74581 -0.48456,1.55123 0.0901,1.69943 0.89769,0.84225 0.39341,0.78575 1.62746,0.56132 1.2911,-0.44938 0.89823,0.39341 0.28092,0.9542 -0.11247,1.06614 1.23512,0.3369 1.12265,-0.22442 0.67327,0.61729 -0.3369,1.0107 -0.22443,0.78575 0.39288,0.89823 -0.50482,1.29109 0.056,1.06668 0.9542,0.72977 0,1.57149 -0.16845,1.06668 0.28093,1.17862 0.39287,0.72977 -0.44938,1.51552 0.50535,1.23513 0.50535,1.01017 -0.3369,0.84225 0.56132,1.34707 0.50536,0.95419 -0.0565,1.2911 0.39341,1.23513 0.74523,1.05761 0.44885,1.12265 -0.056,1.06614 1.40358,1.17915 -0.0565,1.40304 1.2911,1.57149 0.89822,1.17916 0.72978,0.89822 0.72977,2.02034 0.84172,0.61783 0.6738,1.34707 0.11195,1.06614 -0.89769,1.628 -0.39341,1.01017 0.44938,1.85242 0.16845,1.51552 -0.56133,1.23512 -0.16845,1.51552 -0.39287,1.73995 0.2804,1.17862 -0.056,1.23512 -0.16845,1.73994 0.44885,1.628 0.6738,1.2911 1.17862,0.78574 0.89822,1.01017 2.30127,1.12265 -0.28039,0.89822 -0.89823,1.01017 -0.16845,1.12265 1.01017,1.01017 0.72977,0.28093 0.39288,1.01017 0.44938,1.0107 0.95419,0.67327 0.77082,0.94993 0,0.88863 1.35667,0.98245 -0.46804,1.07574 0.18711,1.49686 0.28093,1.12264 -0.60824,1.16903 0.18711,1.35666 0.32731,1.07574 -0.88863,0.65461 -0.37422,0.84225 0.18711,1.07574 0.60823,0.65461 -1.54377,0.60823 -0.93554,0.1402 -1.02882,0.88916 -0.98245,1.21594 -1.02883,1.26284 -0.46804,0.70152 -1.07573,1.21647 -0.98192,0.6077 -1.26284,0.0938 -0.23402,-1.02936 -0.23402,-0.74789 -0.84172,-0.32784 -1.07574,0.70152 -0.56132,0.88916 0.0464,1.26284 0.0938,1.26285 0.28039,0.42112 0.37422,1.02883 -0.1402,0.79534">
                        <title>East Godavari</title>
                    </path>
                </a>
                </g>
        </svg>
    </div>



    <div id="bottom" data-ng-view="">
        <!--
     This DIV loads templates depending upon route.
 -->
    </div>

</body>

Hii i found an issue when using angularjs ui routing .here ui routing is not working in firefox in few cases not working in crome v.49 so how to solve these kind of issues here is my plunker code https://plnkr.co/edit/hPbh2QjkkeVTAjW8Zsmc?p=preview not woking in firefox


回答1:


Working Demo

The problem is not related to angular ui-route. It's an issue with <a> tags in <svg> elements that already suggested by Phil. Add xlink: before href attribute. Also add target="_self" attribute in anchor tag.

<a xlink:href="#/EastGodavari" id="94650dac-e76b-4dec-8fcc-2d40dff7d95d" class="District" title="EastGodavari" target="_self">

If you want to use anchor tag in svg, please read this MDN article.

Hope that solve your problem.



来源:https://stackoverflow.com/questions/36905853/angularjs-ngroute-is-not-working-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!