javascript - 修复 AngularJS 网站的#tag inurl?

标签 javascript html angularjs seo

目前我的网址是这样的:

example.com/#/services

需要新的网址:

example.com/services

即,我不想在网站 url 中使用 # 标签。

谁能描述我应该如何解决这个 url 问题 - 我要编辑或检查哪个文件来解决这个问题?

最佳答案

在您的应用配置或路由器模块中,注入(inject) $locationProvider 并配置为 html5 模式。

angular.module('myApp', [])
.config(function($locationProvider) {
  $locationProvider.html5Mode(true);
});

关于javascript - 修复 AngularJS 网站的#tag inurl?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23172169/

相关文章:

javascript - 当页面不活动时停止 setTimeout 循环,当页面事件时重新启动

javascript - 通知 Angular 一个变量已经改变

javascript - 单击事件后范围属性未反射(reflect)在 View 中

javascript - 在 ng-repeat 循环期间或循环后更改属性?

javascript - "next"和 "previous"按钮在此触摸 slider 插件中不起作用

javascript - 在 ReactJS 中中断 ContentEditable Div 上的 Enter 键

javascript - 何时使用调用 javascript 函数作为参数及其优点

javascript - 选择复选框列表上的所有功能

html - 没有文本的 contenteditable div 中的插入符号样式

javascript - 使用JS移动div内的div