|
index.html的主要代码如下
- <body ng-app="start" >
- <ion-view>
-
- <p>
-
- <ion-spinner icon="bubbles" class="spinner-balanced"></ion-spinner>
- </p>
-
-
- </ion-view>
- </body>
复制代码
对应的app.js代码如下
- angular.module('start', ['ionic','controllers'])
- .run(function($ionicPlatform,$state,$state) {
- $ionicPlatform.ready(function() {
- // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
- // for form inputs)
- if (window.cordova && window.cordova.plugins.Keyboard) {
- cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
- }
- if (window.StatusBar) {
- StatusBar.styleDefault();
- }
- });
- })
- .config(function($stateProvider, $urlRouterProvider) {
- $urlRouterProvider.when("", "/activate");
- $stateProvider
- .state('activate', {
- url:'/activate',
- templateUrl: 'templates/activate.html',
- controller: 'Activate'
-
- })
- .state('lock', {
- url:'/lock',
-
- templateUrl: 'templates/gusturelockPage.html',
- controller: 'Lock'
- })
- .state('main', {
- url:'/main',
-
- templateUrl: 'templates/mainpage.html',
- controller: 'UserInfo'
- });
- // if none of the above states are matched, use this as the fallback
- // $urlRouterProvider.otherwise('/activate');
- });
复制代码
其中controllers是另外在一个controllers.js里面声明的控制器模块,angular.module('start', ['ionic','controllers'])把它也包进来了。
上面用到的要跳转的html都放在了一个新建的template文件夹当中。
新人求问,为什么index.html打开运行之后不跳转到activate对应的html呢?
|
|