通过角度加载闪屏(HTML)

时间:2016-05-17 06:29:37

标签: javascript jquery angularjs splash-screen

我在HTML5和jQuery中创建了一个启动画面。我想用角加载它。但我得到一个错误 - 警告:尝试多次加载角度。

Synchronous XMLHttpRequest on the main thread is deprecated because of its
detrimental effects to the end user's experience. For more help,
check http://xhr.spec.whatwg.org/.

我的js:



  angular.module('app')
    .controller('SplashCtrl',['$scope', 'cordova',
    function ($scope,$window,cordova,$location){
  
      /*Uncomment this for device*/
      // cordova.ready.then(function () {
      //   console.log('Cordova is ready');
      //   console.log("Ready....");
      // });


      $('#splash').ready() 
      {
        $('#main').load('views/splash.html');
        setTimeout(function() {
            $('#main').ready(function() {
                $('#splash').remove();
               window.location.href = "/#/login";
                console.log("path.." + path)
            });
        }, 2000);
      }

  }]); 
  
})();




app.js:



(function () {
    'use strict';
   
    angular
        .module('app', ['ngRoute', 'ngCookies'])
        .config(config);
        

    config.$inject = ['$routeProvider', '$locationProvider', '$httpProvider'];
    function config($routeProvider, $locationProvider, $httpProvider) {
        $routeProvider
            .when('/', {
                controller: 'SplashCtrl',
                templateUrl: 'views/splash.html',
                controllerAs: 'splash'
            })
            .when('/login', {
                controller: 'LoginCtrlr',
                templateUrl: 'views/login.html',
                controllerAs: 'login'
            })
            .when('/pay', {
                controller: 'PaymentCtrl',
                templateUrl: 'views/payment.html',
                controllerAs: 'pay'
            })
            .when('/scan', {
                controller: 'ScanCtrl',
                templateUrl: 'views/scan.html',
                controllerAs: 'scan'
            })
            .otherwise({ redirectTo: '/' });

            
            //$httpProvider.defaults.headers.post = {};
            $httpProvider.defaults.headers.post['Access-Control-Allow-Origin'] = '*';
            //$httpProvider.defaults.headers.common['Access-Control-Allow-Origin'] = '*';



            $httpProvider.defaults.headers.post['Accept'] = 'application/json';
            $httpProvider.defaults.headers.post['Content-Type'] = 'application/json; charset=utf-8';
            $httpProvider.defaults.headers.post['Access-Control-Max-Age'] = '1728000';
            
    }

})();




0 个答案:

没有答案