Javascript 从当前URL提取数据,并在angularjs的控制器中使用

Javascript 从当前URL提取数据,并在angularjs的控制器中使用,javascript,angularjs,html,url,url-routing,Javascript,Angularjs,Html,Url,Url Routing,我正在开发一个使用angularjs的网站,其中只有一个html页面。我想通过将url中的记录Id设置为abc.in/1来显示该记录。当我试图从url中给出这个Id时,它给出了404notfount错误。但是当我在#1中给出abc.in时,它工作正常并显示记录。 我试过了 angular.module('myApp', [ 'ngRoute', 'ngResource', 'ngCookies', 'myApp.filters', 'myApp.service

我正在开发一个使用angularjs的网站,其中只有一个html页面。我想通过将url中的记录Id设置为
abc.in/1
来显示该记录。当我试图从url中给出这个Id时,它给出了
404notfount
错误。但是当我在#1中给出abc.in时,它工作正常并显示记录。 我试过了

angular.module('myApp', [
      'ngRoute', 'ngResource', 'ngCookies',
      'myApp.filters',
      'myApp.services',
      'myApp.directives',
      'myApp.controllers',
      'ui.bootstrap', 'ngAnimate', 'ngDragDrop'  //'ngSanitize',
    ]).
    config(['$routeProvider','$locationProvider', function ($routeProvider,$locationProvider) {

     $routeProvider.when('/',
          {
              templateUrl: '/Login.html',
              controller: 'LoginController'
          });

        $routeProvider.when('/:id',
          {
              templateUrl: '/Login.html',
              controller: 'LoginController'
          });

        $routeProvider.otherwise({ redirectTo: '' });

    if (window.history && window.history.pushState) {
                    $locationProvider.html5Mode({
                    enabled: true,
                    requireBase: false
                });                    
            }
在我的app.js和Login.html(这是默认设置,也是我应用程序中唯一的页面)中-


根据给定的代码,我首先需要在url中给出
#1
,然后它将转换为
/
。但我想先给出
/1
。怎么做?

我在考虑
domain.com/#/:id
->
domain.com/#/1
,这将是一条有角度的路线。domain.com/1不是angularJS路线。为什么需要在头部设置
base
domain.com/1
是必需的。我们可以这样做吗?不,它不受支持,因为:->还有其他方法吗?我也尝试过使用一个简单的ajax调用。但它也需要
#
来显示结果。这里是参考-[为什么在angularJS中使用AJAX?
<base href="/">
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.