angular-rails-templates icon indicating copy to clipboard operation
angular-rails-templates copied to clipboard

I got empty page in production mode

Open NSLog0 opened this issue 7 years ago • 3 comments

Hi, I deployed my application to aws ec2 via elastic beanstalk(eb), Then I tried to enter to my application but I got blank page and no error on javascript console, no error log in server.

On web inspector don't have any content inside ui-view screen shot 2560-06-08 at 1 30 20 am

I'm not sure is related with angular-rails-temples but only I thought right now my application use this lib to serve view. Anyone help me please.

Thank you

NSLog0 avatar Jun 07 '17 18:06 NSLog0

Update

I found answer https://github.com/pitr/angular-rails-templates/issues/97 that tell to use 'sprockets', I just try and still not working for me

NSLog0 avatar Jun 07 '17 18:06 NSLog0

I found something in route and considering below

'use strict'

alert('route'); <----- is working

angular.module('core').config(['$stateProvider', '$urlRouterProvider',
  function ($stateProvider, $urlRouterProvider) {
    // Redirect to 404 when route not found
    $urlRouterProvider.otherwise(function ($injector, $location) {
      $injector.get('$state').transitionTo('not-found', null, {
        location: false
      });
    });

    alert('inside route') <--- is working
    // Home state routing
    $stateProvider
    .state('home', {
      url: '/',
      abstract: true,
      templateUrl: 'players/layout/home.client.view.html',
      controllerAs: 'vm',
      controller: 'MasterController',
      resolve: {
        user_noti: function($http, $stateParams,jwtHelper, $window) {
         alert('insde part') <--- not woking
          if($window.user) {
            return $http.get('/api/v1/notifications');
          } else {
            return [];
          }
        },
        user_unconfrim_ticket: function($http, $stateParams,jwtHelper, $window){
          if($window.user) {
            return $http.get('/api/v1/tickets/unconfrim');
          } else {
            return [];
          }
        }
      }
    })
    .state('home.index', {
      url: '',
      controllerAs: 'vm',
      controller: 'HomeController',
      data: {
        ignoreState: true
      },
      templateUrl: 'players/home.client.view.html',
      resolve: {
        reward_data: function($http, $stateParams) {
          return $http.get('/api/v1/rewards');
        },
        answers_data: function($http, $stateParams){
          return $http.get('/api/v1/answers/current');
        }
      }
    })
    .state('home.game', {
      url: 'game',
      controller: 'GameController',
      controllerAs: 'vm',
      data: {
        roles: ['player']
      },
      templateUrl: 'players/game/game.client.view.html'
    });
  }
]);

And I put alert() in top of controller file is working and inside controller function is not working, I thought is not working since route can't detect the path

Any Sugesstion?

NSLog0 avatar Jun 10 '17 06:06 NSLog0

Update: I found actually problem, A real problem. if some state have resolve function it will be freeze ui. I don't know why because I never met before. I working with resolve many time only error form server will make resolve and ui will freeze. I ran "rails s -e production" is work normal but on real server not working

NSLog0 avatar Jun 10 '17 18:06 NSLog0