Как установить страницу по умолчанию в Angular
Я получаю сообщение об ошибке, когда запрашиваю ссылку с этим URL: http://xxx:46630/
или с этим http://crmbyzaid.azurewebsites.net/
Но это работает хорошо, когда я добавляю '/index.html'
с URL. Теперь я хочу установить визуализацию по умолчанию для моей частичной страницы "app/dashboard/dashboard.html", когда я запрашиваю только http://crmbyzaid.azurewebsites.net/
Мой код config-route.js
function routeConfigurator($routeProvider, routes) {
routes.forEach(function (r) {
$routeProvider.when(r.url, r.config);
});
$routeProvider.otherwise({ redirectTo: '/' });
}
function getRoutes() {
return [
{
url: '/',
config: {
templateUrl: 'app/dashboard/dashboard.html',
title: 'dashboard',
settings: {
nav: 1,
content: '<i class="fa fa-dashboard"></i> Dashboard'
}
}
}, {
url: '/admin',
config: {
title: 'admin',
templateUrl: 'app/admin/admin.html',
settings: {
nav: 1,
content: '<i class="fa fa-lock"></i> Admin'
}
}
}
]
}
1 ответ
Поскольку Azure работает на IIS, вам нужен web.config, чтобы сообщить ему, как обрабатывать вещи. Это должно решить вашу корневую страницу:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Назовите файл web.config и сохраните его в своем веб-корне.
Надеюсь, это поможет!