我正在使用Angular2 Seed应用程序,您可以在
official repo中找到它.正如您所看到的,这里我们已经导入了angular2 / router,我们正在使用它来创建应用程序的基本路由.
import {Component,ViewEncapsulation} from 'angular2/angular2'; import { RouteConfig,ROUTER_DIRECTIVES } from 'angular2/router'; ... @RouteConfig([ { path: '/',component: HomeCmp,as: 'Home' },{ path: '/about',component: AboutCmp,as: 'About' } ]) export class AppCmp {}
我的问题是:如何配置路由器在我的网址中添加主题标签,使其看起来像:localhost:5555 /#/ about.有没有美丽而简单的方法来制作它? (与之前的$locationProvider一样)
我知道这很奇怪,但我曾经在网址中喜欢这个标签,而我的apache-config也曾经喜欢它.当然,我可以更改我的httpd.conf文件,非常简单和正确,但我真的想弄清楚,如何简单地添加hashtag,与Angular2路由器.