如何使用 AngularJs ui-router 从 URL 中删除 index.html 和感叹号 (!)?

How to remove index.html and exclamation sign(!) from URL using AngularJs ui-router?

我的状态配置js

现在,我的 URL 看起来像这样

我想从我的 URL 中删除 index.html 和 (!)。就像下图一样 如何做到这一点?

查阅 $location 方法 html5ModehashPrefix 的文档:https://docs.angularjs.org/guide/$location

$location.hashPrefix('');