ng-view未在Android Chrome应用中加载网站

时间:2017-08-10 14:05:36

标签: angularjs google-chrome angular-ui-router

之前可能已经提出过这个问题。但是这里有:

我的网站是http://thecheeknee.com

网站的基本结构如下:

`index.html
js|-app.js
js|ctrls|pageLoad.js  -common controller for all pages
js|srvc|Datamap.js
templates/-about.html, etc`

HTML基本视图如下所示:

<section ui-view></section>

UI路由器角度代码如下:

angular
.module('app',[
    'ui.router',
    'ngStorage'
    ])
.config(['$urlRouterProvider','$stateProvider',function($urlRouterProvider, $stateProvider){
    $urlRouterProvider.otherwise('/');
    $stateProvider
        .state('home',{
            url:'/',
            templateUrl:'templates/home.html',
    controller:'pageLoad'
        })

控制器非常基本。

angular
.module('app')
.controller('pageLoad',[ '$scope', 'Datamap', function($scope, Datamap){
    $scope.title = "thecheeknee";
    //$scope.$storage = $localStorage;
    //$scope.$storage.counter = $scope.$storage.counter+1 || 0;
    Datamap.getData().then(function(response){

  $scope.datamap = response.data;
});

数据地图服务如下:

angular.module('app')
  .factory('Datamap', function($http) {
    //debugger;
    return{
      getData: function(){
        return $http.get('data/data.json',{ cache: true});
      }
    }
  });

该网站可在多个浏览器的桌面上完美运行。但Android上的Chrome应用似乎加载了空白页面。 (我设计的网站具有响应能力,并使用Chrome浏览器工具彻底测试了用户界面)

观察时,我注意到浏览器添加了#!/ 并将视图加载到页面中。然而,在移动浏览器上,似乎停止在站点名称本身(#!/未添加)。所以我假设UI路由器无法将路由加载到页面中。

我对Angular比较新,所以我在这里错过了什么小事?

完整源代码:https://github.com/thecheeknee/sitebase.git

0 个答案:

没有答案