简体   繁体   English

如何在控制器下添加Angular js html5mode

[英]How to add angular js html5mode under controller

I am new in Angular js.I try to make html5 mode true in one of my controller .In my angular js app there is 3 controller but i need to html5 mode true in one of them not in all controller. 我是Angular js的新手,我尝试在我的一个控制器中使html5模式为true。在我的angular js应用程序中有3个控制器,但我需要在其中一个中而不是在所有控制器中为html5模式为true。 I am using 我在用

App.config(function($locationProvider) {
  $locationProvider.html5Mode(true);     
});

But this config effect all of my controller.I need to add html5mode true under one of my controller.I don't know is it possible or not . 但是这个配置会影响我的所有控制器。我需要在一个控制器下添加html5mode true。我不知道是否可能。

Providers are only available when instantiating an Angular module. 提供程序仅在实例化Angular模块时可用。 You can only use providers for a module before it is instantiated inside a config block. 您只能在模块中将其实例化之前在模块中使用提供程序。 So you can configure $locationProvider once per module and not at the controller level. 因此,您可以$locationProvider每个模块配置一次$locationProvider ,而不是在控制器级别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM