2017-03-12 15 views
0

私はイオン性が新しい。私はイオンタブで遊んでいます。以下の私のコードです: - 私はUIでレンダリングされるタブを期待していますが、問題はタブバーとタブがまったく表示されない、ということであるion-tabがイオン性で働いていない理由

// 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){ 
 
\t $stateProvider 
 
    .state('abc', { 
 
     url: "/abc", 
 
     abstract: false, 
 
     templateUrl: "abc.html" 
 
    }) 
 
\t .state('def', { 
 
     url: "/def", 
 
     abstract: false, 
 
     templateUrl: "def.html" 
 
    }) 
 
\t .state('main', { 
 
     url: "/main", 
 
     abstract: false, 
 
     templateUrl: "main.html" 
 
    }); 
 
\t $urlRouterProvider.otherwise(function ($injector, $location) { 
 
\t \t var $state = $injector.get("$state"); 
 
\t \t $state.go("main"); 
 
\t }); 
 
});
<!-- index.html --> 
 
<!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"> 
 
\t 
 
\t <script type="text/ng-template" id="def.html"> 
 
\t \t <ion-view> 
 
\t \t \t <ul class="list"> 
 
\t \t \t \t <h1><a class="item">abc</a></h1> 
 
\t \t \t \t <h2><a class="item">def</a></h2> 
 
\t \t \t </ul> 
 
\t \t </ion-view> 
 
\t </script> 
 
\t 
 
\t <script type="text/ng-template" id="main.html"> 
 
\t \t <ion-view> 
 
\t \t \t <ion-tabs class="tabs-icon-top tabs-balanced"> \t \t \t \t 
 
\t \t \t \t <ion-tab title="Dashboard" icon="ion-home" href="#/abc"> 
 
\t \t \t \t <ion-nav-view name="dash-tab"></ion-nav-view> 
 
\t \t \t \t </ion-tab> 
 
\t \t \t \t 
 
\t \t \t \t <ion-tab title="Public" icon="ion-earth" href="#/def"> 
 
\t \t \t \t <ion-nav-view name="public-tab"></ion-nav-view> 
 
\t \t \t \t </ion-tab> 
 
\t \t \t \t 
 
\t \t \t \t <ion-tab title="Secret" icon="ion-nuclear" href="#/abc"> 
 
\t \t \t \t <ion-nav-view name="admin-tab"></ion-nav-view> 
 
\t \t \t \t </ion-tab> 
 
\t \t \t 
 
\t \t </ion-tabs> 
 
\t \t </ion-view> 
 
\t </script> 
 
\t 
 
\t <script type="text/ng-template" id="abc.html"> 
 
\t \t <ion-view> 
 
\t \t \t <ion-content class="padding"> 
 
\t \t \t \t <h1> Sub header example 1</h1> 
 
\t \t \t \t <h1> Sub header example 2</h1> 
 
\t \t \t \t <h1> Sub header example 3</h1> 
 
\t \t \t \t <h1> Sub header example 4</h1> 
 
\t \t \t \t <h1> Sub header example 5</h1> 
 
\t \t \t \t <h1> Sub header example 6</h1> 
 
\t \t \t \t <h1> Sub header example 7</h1> 
 
\t \t \t \t <h1> Sub header example 8</h1> 
 
\t \t \t \t <h1> Sub header example 9</h1> 
 
\t \t \t \t <h1> Sub header example 10</h1> 
 
\t \t \t \t <h1> Sub header example 11</h1> 
 
\t \t \t \t <h1> Sub header example 12</h1> 
 
\t \t \t \t <h1> Sub header example 13</h1> 
 
\t \t \t \t <h1> Sub header example 14</h1> 
 
\t \t \t \t <h1> Sub header example 15</h1> 
 
\t \t \t </ion-content> 
 
\t \t </ion-view> 
 
\t </script> 
 
    
 
    <ion-side-menus> 
 
\t \t <ion-side-menu-content> 
 
\t \t \t <ion-nav-bar class="bar-positive"> 
 
\t \t \t \t <ion-nav-buttons side="left"> 
 
\t \t \t \t \t <button class="button button-icon ion-navicon" menu-toggle="left"></button> 
 
\t \t \t \t </ion-nav-buttons> 
 
\t \t \t \t <ion-nav-buttons side="right"> 
 
\t \t \t \t \t <button class="button button-icon ion-search"></button> 
 
\t \t \t \t \t <button class="button button-icon ion-ios-email"></button> 
 
\t \t \t \t \t <button class="button button-icon ion-ios-person"></button> 
 
\t \t \t \t </ion-nav-buttons> 
 
\t \t \t \t <h1 class="title"> Main Nav bar</h1> 
 
\t \t \t </ion-nav-bar> 
 
\t \t \t <ion-header-bar class="bar bar-balanced bar-subheader"> 
 
\t \t \t \t <button class="button button-icon icon ion-chevron-left"></button> 
 
\t \t \t \t <button class="button">ABC</button> 
 
\t \t \t \t <h2 class="title">Sub Header</h2> 
 
\t \t \t </ion-header-bar> 
 
\t \t \t <ion-footer-bar class="bar bar-footer bar-positive"> 
 
\t \t \t \t Footer 
 
\t \t \t </ion-footer-bar> 
 
\t \t \t <ion-nav-view> 
 
\t \t \t </ion-nav-view> 
 
\t \t </ion-side-menu-content> 
 
\t \t <ion-side-menu side="left"> 
 
\t \t \t <ul class="list"> 
 
\t \t \t \t <a class="item" href="#/abc">first</a> 
 
\t \t \t \t <a class="item" href="#/def">second</a> 
 
\t \t \t </ul> 
 
\t \t </ion-side-menu> 
 
\t </ion-side-menus> 
 
    </body> 
 
</html>

私はどこに行方がわからないのですか。 悪い英語をお詫び申し上げます。前もって感謝します。

答えて

0

私はあなたが追加することを忘れていると思います。そのため、ヘッダーはアプリでレンダリングできません。 P.S IONICでHTMLタグを使用しないでください。 IONIC固有のコードを使用してください。

<ion-header> 
<ion-navbar> 
    <button ion-button menuToggle> 
    <ion-icon name="menu"></ion-icon> 
    </button> 
    <ion-title>Page Two</ion-title> 
</ion-navbar> 
</ion-header> 
+0

問題はヘッダーではなく、問題はタブが表示されないことです。 –

関連する問題