Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49188

Ionic run android works with livereload (-l -c) but it does not work without ir (the controller is not loaded)

$
0
0

@dlopezgonzalez wrote:

I have a big problem here.

I have got an ionic app that works using these commands:
- ionic serve
- ionic run android -l -c

But it does not work with this:

  • ionic run android

The problem is that the first controller is not loaded so the application load index.html and then does not load the next view and the controller.

Code:

.config(function($ionicConfigProvider, $stateProvider, $urlRouterProvider, $sceDelegateProvider) {

console.log("angular config begins");

$sceDelegateProvider.resourceUrlWhitelist([
    // Allow same origin resource loads.
    'self',
    // Allow loading from our assets domain.  Notice the difference between * and **.
    'http://foo.com/**',
    '*'
]);

$template_dir = "/templates/"; // #deploy# "";

$stateProvider

// setup an abstract state for the tabs directive
.state('tab', {
url: '/tab',
abstract: true,
templateUrl: $template_dir + 'tabs.html',
controller: 'TabCtrl'
})

// Each tab has its own nav history stack:

.state('tab.videosvideos', {
url: '/videos',
views: {
'tab-videosvideos': {
templateUrl: $template_dir + 'tab-videos.html',
controller: 'VideosCtrl'
}
}
})

...

// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/tab/videos');

...

console.log("angular config executed");

});

app.controller('VideosCtrl',
                ["$scope", "$rootScope", "$http", "$stateParams", "$ionicPopup", "$ionicLoading", "$cordovaDevice", "SimpleTracker", "rest_server_url", "debug",
                function($scope, $rootScope, $http, $stateParams, $ionicPopup, $ionicLoading, $cordovaDevice, SimpleTracker, rest_server_url, debug) {

    console.log("app VideosCtrl begins");

    ....

The trace with livereload and ionic serve is:

angular config begins
angular config executed
app VideosCtrl begins

But on "ionic run android" the trace is only:

angular config begins
angular config executed

Any idea about this?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>