Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
推送状态在AngularJS中显示错误_Angularjs_Seo_Pushstate - Fatal编程技术网

推送状态在AngularJS中显示错误

推送状态在AngularJS中显示错误,angularjs,seo,pushstate,Angularjs,Seo,Pushstate,我在我的站点中使用了推送状态,用于搜索引擎优化 当我使用推送状态时,它会显示我在下面显示的这些错误 Uncaught Error: [$injector:modulerr] Failed to instantiate module projectApp due to: 这是我的AngularJS代码 <script> var countryApp = angular.module('projectApp', ['ngSanitize']); countryApp.config(['

我在我的站点中使用了推送状态,用于搜索引擎优化

当我使用推送状态时,它会显示我在下面显示的这些错误

Uncaught Error: [$injector:modulerr] Failed to instantiate module projectApp due to:
这是我的AngularJS代码

<script>
var countryApp = angular.module('projectApp', ['ngSanitize']);
countryApp.config(['$location',function ($location) {
$location.html5Mode(true);
}]);
</script>

var countryApp=angular.module('projectApp',['ngSanitize']);
countryApp.config(['$location',函数($location){
$location.html5模式(true);
}]);

您正试图将服务注入配置函数。这是不可能的。只能注入常量和提供程序。而是注入$locationProvider

countryApp.config(['$locationProvider',function ($locationProvider) {
   $locationProvider.html5Mode = true;
}]);

在此处指定更多代码,以便更好地理解,如给定html页面code@NiraleePatel:对于这个问题,这么多代码就足够了……你能在页面中添加myApp=“projectApp”吗?@NiraleePatel:你能解释清楚吗,你想说什么……你注入了locationProvider吗?我更新了response,因为它是错误的…事实上,我是AngularJS的新手,所以如果你有任何对我有用的演示,我如何注入位置提供程序。这个示例帮助很好,谢谢:)请不要犹豫,如果答案正确,请验证答案:)这里的内容不显示在使用AngularJS的视图源代码中,但在您的示例中,内容是直接给出的。