HTML5模式的PhoneGap和AngularJS [英] HTML5 mode with Phonegap and AngularJS
问题描述
我试图让AngularJS HTML5模式(真)的工作原理与PhoneGap的。 我做了很多的搜索之前张贴此,我尝试不同的组合 构,添加的<碱/>在meta标签(也试图以<基地的HREF =/>中<基地的HREF =//>和<基地的HREF =/目标=_自我/>) 添加的.html后缀路由终端,增加了$ delegate.history =假(如跟踪)的.config文件块内
I'm trying to make AngularJS html5 mode (true) works with Phonegap. I did a lot of search before to post this, I tried different combination of configurations, adding the <base/> tag in meta ( also tried with <base href="" />, <base href="/" /> and <base href="/" target="_self" /> ), adding the .html suffix to route endpoints,adding the $delegate.history = false (like follow) inside the .config block
$provide.decorator('$sniffer', function($delegate) {
$delegate.history = false;
return $delegate;
});
和明显
$locationProvider.hashPrefix('!');
$locationProvider.html5Mode(true);
但没有办法让它的作品,同时添加标签,并设置html5Mode为true,将导致黑屏时,应用程序启动。 还加入了其中一人将带来同样的结果,黑屏。
but there is no way to make it works, adding both the tag and set html5Mode to true will result in a blank screen when application starts. Also adding one of them will bring to the same result, blank screen.
添加基地标记为android_asset之类的后续
Adding base tag with "android_asset" like follow
将正确加载主控制器,但随后爆发的路由....
will make correctly load the main controller but then breaks routing....
测试与目标属性_blank和_self的价值观......
Tested with target attribute "_blank" and "_self" values...
所以我的问题是, 可HTML5模式下使用的PhoneGap和AngularJS被启用?
So my question is, can html5 mode be enabled using Phonegap and AngularJS?
我使用的科尔多瓦版本3.4.1-0.1.0与AngularJS 1.2.16, 在Android 4.0.4测试真实的设备和Android AVD 4.4.2
I am using cordova version 3.4.1-0.1.0 with AngularJS 1.2.16, tested on Android 4.0.4 real device and Android AVD 4.4.2
任何意见将非常AP preciated! 谢谢
Any advice would be very appreciated! Thanks
推荐答案
根据我的经验,并在来自此评论雷蒙德·卡姆登(谁的作品在PhoneGap的),这是不可能使用html5mode与PhoneGap的+角。
Based on my experience and on this comment from Raymond Camden (who works on PhoneGap) it is not possible to use html5mode with PhoneGap + Angular.
这篇关于HTML5模式的PhoneGap和AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!