Monaca Onsen UI Discord Chat Github Repo

Onsen UI 2 does not work



  • I installed Onsen UI 2 but does not work:

    I followed this example: https://onsen.io/v2/docs/guide/angular1/#loading-onsen-ui-with-angularjs

    <!doctype html>
    <html lang="en" ng-app="my-app">
      <head>
        <meta charset="utf-8">
        <title>Hello</title>
    
        <link rel="stylesheet" href="node_modules/onsenui/css/onsenui.css" />
        <link rel="stylesheet" href="node_modules/onsenui/css/onsen-css-components.css"/>
    
    
        <script src="node_modules/onsenui/js/angular.js"></script>
        <script src="node_modules/onsenui/js/onsenui.js"></script>
        <script src="node_modules/onsenui/js/angular-onsenui.js"></script>
    
        <script>
          var app = angular.module('my-app', ['onsen']);
          module.controller('AppController', function($scope) { });
          module.controller('PageController', function($scope) {
            ons.ready(function() {
              // Init code here
            });
          });
        </script>
      </head>
      <body ng-controller="AppController">
        <ons-navigator var="navigator">
          <ons-page ng-controller="PageController">
            <!-- Page content -->
          </ons-page>
        </ons-navigator>
      </body>
    </html>
    

    0_1463062797268_error.png

    What’s going on?


  • Onsen UI

    @anderson As the error says, module is not defined. The created variable is called app, not module. This is an error in the documentation, we’ll update it. Thanks!