我有 main.cshtml 文件它有一个包含 css 和 js 引用的 head 标签。
我有两个指令/模板。我想有不同的两个标题。当 page1 打开(有 template1)时,我希望页面的标题为 Page-1。当 page2 打开(有模板 2)时,我希望页面的标题为 Page-2。
我试图将头部标签放到指令中,但它没有读取标题和标题图标。
<div style="height: 100%">
<head>
<title>{{::title}}</title>}}
<link rel="shortcut icon" href="../../../../icons/icon1.ico">
</head>
<div class="..." >
<div class="...">
<div>...............
它既不能这样工作,也不能在主 div 上使用 head 标签。
我尝试使用路由,在路由中给出标题属性但在配置文件中 rootScope 无法读取。
所以我尝试用模块运行()。但它也没有奏效。
module.run(function($rootScope){
$rootScope.$on("$routeChangeSuccess", function(currentRoute,
previousRoute){
//Change page title, based on Route information
$rootScope.title = $route.current.title; }) ;});
你能帮忙我怎么能有这两个不同的标题和图标。或者如果必须是两个不同的头部标签才能看到它们,我该如何创建它们?