Search code examples
ionic-frameworkionic-view

Ionic app showing html code in simulator


I just getting started with Ionic and have done environment setup for the same, but when I tried to emulate the app, below is happening:

  1. Able to start the simulator
  2. App also starts but it shows "html code" instead of app

Below are my files, I appreciate any help finding any mistakes.

index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Todo</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1,     user-scalable=no, width=device-width">

<link href="lib/ionic/css/ionic.min.css" rel="stylesheet">
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src=“js/app.js”></script>

</head>
<body ng-app="todo">
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Awesome App</h1>
</ion-header-bar>
<ion-content class="padding">
<button class="button button-assertive">I'm a button</button>
</ion-content>
</ion-pane>
</body>
</html>

app.js angular.module(‘todo’, ['ionic’]);

output on simulator is as follows :


Solution

  • Change quotation marks from <script src=“js/app.js”></script> to <script src="js/app.js"></script>

    app.js should look like this

    angular.module('todo', ['ionic'])
    
    .run(function($ionicPlatform) {
      $ionicPlatform.ready(function() {
        if(window.cordova && window.cordova.plugins.Keyboard) {
    
          cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    
          cordova.plugins.Keyboard.disableScroll(true);
        }
        if(window.StatusBar) {
          StatusBar.styleDefault();
        }
      });
    })
    

    And your app should look like this

    enter image description here