基础 URL 没有在 Angular JS 中引入登录页面

Base URL is not bringing Login Page in Angular JS

我想在基础 url 中显示登录页面。目前我在本地开发人员工作,所以我想在地址栏中输入“http://localhost:xxxx”时打开 Login.html。

Views/index.html

我在这里使用了以下内容:-

<base href="/">

RouteMainController.js

app.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
    $urlRouterProvider.otherwise('/');
    $stateProvider       
        .state('login', {
            url: '/',
            views: {
                'mainview':
                {
                    templateUrl: 'Views/Login.html',
                    controller: 'ctrlLogin'
                }
            }
        })        
$locationProvider.html5Mode(true);
})

当我在地址栏中写下以下内容时,登录页面如期出现:- http://localhost:50578/Views/index.html

然而,当我在地址栏中写下以下内容时:- http://localhost:50578/ 然后它给我以下错误:-

启用目录浏览没有帮助,因为这样做会打开文件夹结构。

请帮忙解决这个问题。

经过一系列调查后,我更正了以下内容以使其正常工作:-

  • index.html 在 "Views" 文件夹下。我把它放在外面并在根级别。
  • 在 web.config 中,我做了以下更改:-

早些时候:-

<action type="Rewrite" url="/Views/" />

改为

<action type="Rewrite" url="/" />

希望这个解决方案能有所帮助。