[Solved] I want to create a application in ionic with multiple page but i am not able to link other pages to a button


index.html

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

    <link rel="manifest" href="https://stackoverflow.com/questions/42610680/manifest.json">
    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->
    <script src="cordova.js"></script>
    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>
   <script src="js/angular-ui-router.min.js"></script>

    <!-- cordova script (this will be a 404 during development) -->

    <script src="https://cdnjs.cloudflare.com/ajax/libs/ng-cordova/0.1.27-alpha/ng-cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>

    <script src="js/homeController.js"></script>
    <script src="js/secondController.js"></script>

  </head>
  <body>

    <ion-pane>
        <ion-content>
            <div id="wrapper" ui-view></div>
        </ion-content>
    </ion-pane>
  </body>
</html>

app.js

var app = angular.module('starter', ['ionic','ngCordova', 'ui.router'])

app.run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
      if(window.cordova && window.cordova.plugins.Keyboard) {
        // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
        // for form inputs)
        cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

        // Don't remove this line unless you know what you are doing. It stops the viewport
        // from snapping when text inputs are focused. Ionic handles this internally for
        // a much nicer keyboard experience.
        cordova.plugins.Keyboard.disableScroll(true);
      }
      ionic.Platform.fullScreen();
      if(window.StatusBar) {
        StatusBar.styleDefault();
      }
  });
})

 app.config(function($stateProvider, $urlRouterProvider){
  $stateProvider
    .state('index', {
      url: "",
          templateUrl: "home.html",
          controller: "homeController"            
    })

    .state('second', {
      url: "/second",
          templateUrl: "second.html",
          controller: "secondController"
    })
});

home.html

<div style="width:100px;height: 50px;background-color: blue">home</div>
<button ui-sref="second">click</button>

second.html

<div style="width:100px;height: 50px;background-color: green">second</div>
<button ui-sref="index">click</button>

homeController.js

app.controller('homeController', function($scope,$ionicPlatform,$state) {

});

secondController.js

app.controller('secondController', function($scope,$ionicPlatform,$state) {

});

3

solved I want to create a application in ionic with multiple page but i am not able to link other pages to a button