Ionic1 app gets reload on clicking a button
<p>I have an ionic app with side-menu. My requirement is to have a Login Page before side-menu page.
By clicking on login button first time application gets reload, on clicking second time navigates to the side Menu page.
Here is my code </p>

<p><strong>app.ts</strong></p>

<pre><code>config(function ($stateProvider, $urlRouterProvider) {
$stateProvider

  .state('login', {
    url: '/login',
    templateUrl: 'templates/login.html',
    controller: 'loginCtrl'
  })

  .state('app', {
    url: '/app',
    abstract: true,
    templateUrl: 'templates/menu.html',
    controller: 'AppCtrl'
  })

  .state('app.home', {
    url: '/home',
    cache: true,
    views: {
      'menuContent': {
        templateUrl: 'templates/home.html',
        controller: "homeController"
      }
    }
  })

&lt;ion-view&gt;
&lt;ion-content&gt;
&lt;div class="login-main-heading"&gt;

  &lt;h3 class="all-elements-center login-heading"&gt;Welcome&lt;/h3&gt;

&lt;div class="form-elements responsive-sm"&gt;
  &lt;h5 class="all-elements-center login-heading"&gt;Login&lt;/h5&gt;
  &lt;form action=""&gt;
    &lt;div class="list list-inset"&gt;
      &lt;label class="item item-input"&gt;
             &lt;i class="icon ion-person placeholder-icon"&gt;&lt;/i&gt;
            &lt;input type="text" placeholder="User Name"&gt;
          &lt;/label&gt;
      &lt;label class="item item-input"&gt;
             &lt;i class="icon ion-lock-combination placeholder-icon"&gt;&lt;/i&gt;
            &lt;input type="password" placeholder="Password"&gt;
          &lt;/label&gt;
      &lt;div class="responsive-sm"&gt;
        &lt;button class="button button-large button-assertive button-login"&gt;
           Login
        &lt;/button&gt;
        &lt;button class="button button-large button-assertive button-signup"&gt;
            Sign Up
        &lt;/button&gt;
      &lt;/div&gt;
      &lt;div&gt;
        &lt;button class="button button-block button-positive button-facebook-    login" ng-click="login()"&gt;
           Login 
        &lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/form&gt;
&lt;/div&gt;
&lt;/ion-content&gt;
&lt;/ion-view&gt;
</code></pre>

<p><strong>login-controller.js</strong></p>

<pre><code>angular.module('starter')
.controller('loginCtrl', function ($scope, $state,$ionicSideMenuDelegate) {
$scope.login = function () {
$state.go('app.home');
}
});
</code></pre>

<p><strong>app-controller.js</strong></p>

<pre><code>angular.module('starter.controllers', [])

.controller('AppCtrl', function ($scope, $state) { 
});
</code></pre>