Angular4項目運行時URL自動加#方法

import {HashLocationStrategy , LocationStrategy} from '@angular/common';

@NgModule({
  declarations: [AppCmp],
  bootstrap: [AppCmp],
  imports: [BrowserModule, routes],
  providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}]
});

這樣設置後,訪問angular站點,會自動在根節點後面加一個#錨點。bootstrap

相關文章
相關標籤/搜索