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.
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>
What’s going on?
-
@anderson As the error says,
module
is not defined. The created variable is calledapp
, notmodule
. This is an error in the documentation, we’ll update it. Thanks!