Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Why ons.ready is always executed twice?

  • index.html

    <!DOCTYPE html>
    <html lang="en" ng-csp>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
        <meta http-equiv="Content-Security-Policy">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
            @-ms-viewport { width: 100vw ; zoom: 100% ; }  @viewport { width: 100vw ; zoom: 100% ; }
            @-ms-viewport { user-zoom: fixed ; }           @viewport { user-zoom: fixed ; }
        <link rel="stylesheet" href="lib/onsen/css/onsenui.min.css" />
    	<link rel="stylesheet" href="lib/onsen/css/onsen-css-components.min.css" />
        <link rel="stylesheet" href="lib/onsen/js/angular/angular-csp.css" />
        <script src="lib/onsen/js/angular/angular.min.js"></script>
    	<script src="lib/angular-sanitize/angular-sanitize.min.js"></script>
    	<script src="lib/onsen/js/onsenui.min.js"></script>
    	<script src="lib/onsen/js/angular-onsenui.min.js"></script>
    	<script src="cordova.js"></script>
    	<script src="js/app.js"></script>
    <div ng-controller="PruebaController">


    var myApp = ons.bootstrap('app', ['onsen', "ngSanitize"]);
    myApp.controller('PruebaController', function($scope, $filter, $sce, $http, $q, $interval, $location, $anchorScroll) {
    ons.ready(function() {

    Why ons.ready is always executed twice?

    Thanks in advance

  • Onsen UI

    @arcadio Can you make sure your controller is not running twice?

  • Thank you
    I was running twice the controller