AngularJs仅在页面刷新时加载部分(dashboard.html)

时间:2016-06-29 13:19:10

标签: javascript jquery html angularjs .htaccess

我有angualrJs应用程序,其中我已启用HTML5模式为true并且还在服务器端.htaccess文件中应用了所需的设置,如下所示

.htaccess文件

DirectoryIndex index.html
RewriteEngine on

RewriteBase /timeLeap/

RewriteCond $1 !^(index\.html|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.html [NC,L]

我也插入了<base href="/dir/">$locationProvider.html5Mode(true);

现在,当我尝试刷新任何状态的页面时,它只加载该状态的模板,并且还没有应用角度

网址http://localhost/app/data1

响应:状态仅加载普通data1.html文件,没有角度效果

注意: 但如果我修改url并且这样做,它会按预期加载data1状态

网址http://localhost/app/#data1

响应:按预期工作

所以,如果有人有想法,请告诉我。

0 个答案:

没有答案
相关问题