如何设置缺省页角 [英] How to set Default page in Angular
问题描述
我收到一个错误,当我要求这个网址的链接:的http:// XXX:46630 /
或本 HTTP:/ /crmbyzaid.azurewebsites.net /
但它的工作很好,当我加入/ index.html的
与URL。现在我想设置默认渲染我的部分页面应用程序/仪表板/ dashboard.html时,我只用 http://crmbyzaid.azurewebsites.net/
<要求的/ p>
我的$ C $ç的配置 - route.js 的是
函数routeConfigurator($ routeProvider,路线){ routes.forEach(函数(R){
$ routeProvider.when(r.url,r.config);
});
$ routeProvider.otherwise({redirectTo:'/'});
}
功能getRoutes(){
返回[
{
网址:'/',
配置:{
templateUrl:应用程序/仪表板/ dashboard.html',
标题:仪表盘,
设置:{
导航:1,
内容:'&LT; I类=发发的仪表板&GT;&LT; I&GT /;仪表板'
}
}
},{
网址:'/管理员',
配置:{
标题:'管理员',
templateUrl:应用程序/管理/ admin.html',
设置:{
导航:1,
内容:'&LT; I类=发发锁&GT;&LT; I&GT /;管理员
}
}
}
]
}
由于Azure是运行在IIS上,你需要一个web.config告诉它如何处理的东西。这应该解决您的根页:
&LT;结构&gt;
&LT; system.webServer&GT;
&LT;&改写GT;
&LT;规则与GT;
&LT;规则名称=主要规则stopProcessing =真&GT;
&LT;*匹配URL = /&GT;
&LT;条件logicalGrouping =MatchAll&GT;
&LT;添加输入={} REQUEST_FILENAME使用MatchType =ISFILE否定=TRUE/&GT;
&LT;添加输入={} REQUEST_FILENAME使用MatchType =IsDirectory否定=TRUE/&GT;
&所述; /条件&gt;
&lt;作用TYPE =重写URL =//&GT;
&LT; /规则&GT;
&LT; /规则&GT;
&LT; /重写&GT;
&LT; /system.webServer>
&LT; /结构&gt;
命名文件web.config文件并将其保存到您的Web根目录。
希望帮助!
I am getting an error when I request the link with this URL: http://xxx:46630/
or with this http://crmbyzaid.azurewebsites.net/
But it is working good when I add '/index.html'
with URL. Now I want to set the Default render of my partial page "app/dashboard/dashboard.html" when I request with just http://crmbyzaid.azurewebsites.net/
My code of config-route.js is
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'
}
}
}
]
}
Since Azure is running on IIS, you need a web.config to tell it how to handle stuff.. This should solve your root-page:
<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>
Name the file web.config and save it to your web-root.
Hope that helps!
这篇关于如何设置缺省页角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!