1

Angular $ templateCache,$ stateProvider和ng-include在web瀏覽器中運行得非常漂亮,但是在使用phonegap/cordova的本機ios上,它不會加載模板或轉到美國

我已經通過了清單:

  • 刪除<base href="/">
  • 確保路徑是相對於 「template.html」 與 「/template.html」
  • 確保html5Mode是假的前角
  • 負載templates.js確保依賴注射到位

這裏是原生的IOS在瀏覽器是什麼在起作用一些例子,但不是。

$stateProvider.state('start', { 
    url: '', 
    templateUrl: 'templates/start/start.html' 
}); 

$state.go('start'); 

<div ng-include=" 'fileFromTemplatecache.html' "></div> 

任何想法?我找不到可行的解決方案。

+0

它應該正常工作,東西或者是錯誤的yout路徑或與您的項目設置。也許你的項目文件夾結構的屏幕截圖有助於 –

+0

謝謝,@FranePoljak - 這是一個配置問題。下面我添加了我的解決方案 – user1791914

+0

對於iOS,您可以在Safari - > Developer - >選擇設備/模擬器(您的應用程序正在運行)中檢查錯誤 - > Index.html 希望這有助於您在下次更容易地調試錯誤時 – HardikDG

回答

0

其他人會遇到這個問題,我敢肯定。該解決方案必須處理移動版本的根目錄下的config.xml文件。這對我來說是...

<allow-navigation href="file://*/*"/> 
<allow-navigation href="*"/> 
<allow-intent href="file://*/*"/> 
<allow-intent href="*"/> 
<access origin="file://*/*"/> 
<access origin="*"/>