使用angular.js重新加载窗口后没有获取请求的页面

时间:2015-10-03 05:23:20

标签: angularjs

我正面临一个问题。当我点击<li><a href="course">Course</a></li>链接时,我正在收到请求页面,但当我再次刷新此页面时,它不会使用angular.js.its来清除错误{{ 1}}。我通过输入网址The requested URL /Gofast/subject was not found on this server.来获取我的主页。我正在解释下面的代码。

  

app.js:

oditek.in/Gofast/

我在索引页面中添加了基本网址。请参阅下面的代码。

  

的index.html:

var GoFastoApp=angular.module('GofastoHome',['ngRoute']);
GoFastoApp.config(function($routeProvider,$locationProvider) {
    $routeProvider
    .when('/',{
        templateUrl : 'view/home.html',
        controller  : 'homecontroller'
    })
    .when('/deptinfo',{
        templateUrl : 'view/info.html',
        controller  : 'infocontroller'
    })
    .when('/TimeTable',{
        templateUrl : 'view/time.html',
        controller  : 'timecontroller'
    })
    .when('/course',{
        templateUrl : 'view/course.html',
        controller  : 'coursecontroller'
    })
    .when('/subject',{
        templateUrl : 'view/subject.html',
        controller  : 'subjectcontroller'
    })
    .when('/hod',{
        templateUrl : 'view/hod.html',
        controller  : 'hodcontroller'
    })
    .when('/faculty',{
        templateUrl : 'view/faculty.html',
        controller  : 'facultycontroller'
    });
    $locationProvider.html5Mode({
      enabled: true,
      requireBase: true
    });
})

这时当我点击<!DOCTYPE html> <html lang="en" ng-app="GofastoHome"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <title>...:::WELCOME TO Channabasavashwara Institude of Technology:::...</title> <!-- PACE LOAD BAR PLUGIN - This creates the subtle load bar effect at the top of the page. --> <link href="css/pace.css" rel="stylesheet"> <script src="js/pace.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script data-require="lodash.js@*" data-semver="2.4.1" src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script><script src="js/angularjs.js" type="text/javascript"></script> <script src="js/angularroute.js" type="text/javascript"></script> <script src="controller/app.js" type="text/javascript"></script> </head> <body> <nav class="navbar navbar-default navbar-fixed-top" style="margin-top:50px"> <div class="container" style="width:1270px;"> <div class="navbar-header navbar-brand"> Computer Science & Engineering </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="/Gofast/">Home</a></li> <li class="dropdown"> <a href="/Gofast/" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Edit <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="course">Course</a></li> <li><a href="subject">Subject</a></li> <li><a href="/hod">HOD</a></li> <li role="separator" class="divider"></li> <li class="dropdown-header">Nav header</li> <li><a href="/faculty">Faculty</a></li> <li><a href="#">One more separated link</a></li> </ul> </li> <li><a href="#">Department</a></li> <li><a href="#contact">Time Table</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <script src="controller/HomeController.js" type="text/javascript"></script> <script src="controller/CourseController.js" type="text/javascript"></script> <base href="/Gofast/"> </body> </html> 选项时,所需的页面即将到来,但当我再次重新加载同一页面时,它会抛出上述错误。请帮我解决此错误。

0 个答案:

没有答案