为什么stateprovider不工作离子?

时间:2017-03-11 17:54:52

标签: javascript angularjs ionic-framework



// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic'])

.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);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})
.config(function($stateProvider, $urlRouterProvider){
	$stateProvider
    .state('abc', {
      url: "/abc",
      abstract: true,
      templateUrl: "abc.html"
    });
	$urlRouterProvider.otherwise("/abc");
});
&#13;
<!DOCTYPE html>
<html>
  <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="manifest.json">

    <!-- un-comment this code to enable service worker
    <script>
      if ('serviceWorker' in navigator) {
        navigator.serviceWorker.register('service-worker.js')
          .then(() => console.log('service worker installed'))
          .catch(err => console.log('Error', err));
      }
    </script>-->

    <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">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
  </head>
  <body ng-app="starter">
	
	<script type="text/ng-template" id="abc.html">
		<ion-view>
			<ion-content>
				<h1> Sub header example 1</h1>
				<h1> Sub header example 2</h1>
				<h1> Sub header example 3</h1>
				<h1> Sub header example 4</h1>
				<h1> Sub header example 5</h1>
				<h1> Sub header example 6</h1>
				<h1> Sub header example 7</h1>
				<h1> Sub header example 8</h1>
				<h1> Sub header example 9</h1>
				<h1> Sub header example 10</h1>
				<h1> Sub header example 11</h1>
				<h1> Sub header example 12</h1>
				<h1> Sub header example 13</h1>
				<h1> Sub header example 14</h1>
				<h1> Sub header example 15</h1>
			</ion-content>
		</ion-view>
	</script>
  
    <ion-side-menus>
		<ion-side-menu-content>
			<ion-nav-bar class="bar-positive">
				<ion-nav-buttons side="left">
					<button class="button button-icon ion-navicon" menu-toggle="left"></button>
				</ion-nav-buttons>
				<ion-nav-buttons side="right">
					<button class="button button-icon ion-search"></button>
					<button class="button button-icon ion-ios-email"></button>
					<button class="button button-icon ion-ios-person"></button>
				</ion-nav-buttons>
				<h1 class="title"> Main Nav bar</h1>
			</ion-nav-bar>
			<ion-header-bar class="bar bar-balanced bar-subheader">
				<button class="button button-icon icon ion-chevron-left"></button>
				<button class="button">ABC</button>
				<h2 class="title">Sub Header</h2>
			</ion-header-bar>
			<ion-footer-bar class="bar bar-footer bar-positive">
				Footer
			</ion-footer-bar>
			<ion-nav-view>
			</ion-nav-view>
		</ion-side-menu-content>
		<ion-side-menu side="left">
			<ul class="list">
				<a class="item" href="#/abc">first</a>
			</ul>
		</ion-side-menu>
	</ion-side-menus>
  </body>
</html>
&#13;
&#13;
&#13;

但是,当我点击&#34;第一个&#34;菜单项。我不知道,它有什么问题。

提前致谢。

0 个答案:

没有答案