AngularJs:深层链接默认的index.html是不开放

问题描述:

我开发的角度应用程序,当我打的URL浏览器:http://localhost/angular/MyAngularRewind/,中的index.html是不开放,但实际上它应该已经打开了的index.html。AngularJs:深层链接默认的index.html是不开放

C:\wamp\www\Angular\MyAngularRewind --->这是路径我在哪里具有的index.html,请参见下面

屏幕截图,网页打开时,我打这个网址:http://localhost/angular/MyAngularRewind/index.html和它改变http://localhost/angular/MyAngularRewind/index.html#/

理想地低于事情应该发生:当我打的网址:http://localhost/angular/MyAngularRewind/应该与URL自动更改为http://localhost/angular/MyAngularRewind/index.html/#/打开网页,但它是不会发生我没有线索,为什么发生这种情况。

看到文件结构的屏幕截图。 ss http://i39.tinypic.com/33dw374.png

的Index.html

<html lang="en" ng-app="myApp"> 
     <head> 
      <meta charset="utf-8"> 
      <title>My HTML File</title> 
      <title>Google Phone Gallery</title> 
      <link rel="stylesheet" href="css/app.css"> 
      <link rel="stylesheet" href="css/bootstrap.css"> 
      <script src="lib/angular/angular.js"></script> 
      <script src="js/controllers.js"></script> 
      <script src="js/routes.js"></script> 

     </head> 
     <body ng-controller="appCtrl"> 
      <div class="" ng-view></div> 
     </body> 
    </html> 

的Javascript:

angular.module('myApp', []). 
     config(['$routeProvider', function($routeProvider) { 
      $routeProvider. 
         when('/', 
          { 
          templateUrl: 'partials/partial-For-routes-1.html', 
          controller: appCtrl 
          }). 
         when('/page-2', 
          { 
          templateUrl: 'partials/partial-For-routes-2.html', 
          controller: appCtrl 
          }). 
         when('/page-3', 
          { 
          templateUrl: 'partials/partial-For-routes-3.html', 
          controller: appCtrl 
          }). 
         otherwise({redirectTo:("/")}) 
     }]); 

预先感谢任何帮助。

这个问题可能是与您的服务器,而不是Angularjs - 你需要指示自动服务index.html的服务器,当你访问一个目录(/角/ MyAngularRewind/

说了,我不是确保其服务器使用的,所以我不能提供一个解决方案

+1

Neshar感谢很多的解决方案。它的工作原理后,我在部署新的服务器。 – 2013-05-03 13:59:11