I am building an application with the Ionic Framework. I use tab navigation.
angular.module('myapp', ['ionic']) .config(function ($stateProvider, $urlRouterProvider) { $stateProvider .state('tabs', { url: "/tab", abstract: true, templateUrl: "templates/tabs.html" }) .state('tabs.home', { url: "/home", views: { 'home-tab': { templateUrl: "templates/home.html", controller: 'HomeTabCtrl' } } }) .state('tabs.news', { url: "/news", views: { 'news-tab': { templateUrl: "templates/news.html" } } })....
First I wrote all the code in 1 html file, then for better control I wanted to use html include:
<body> <ion-nav-bar class="bar-app"></ion-nav-bar> <ion-nav-view></ion-nav-view> <script id="templates/tabs.html" type="text/ng-template"> <div ng-include="'sub/tabs.html'"></div> </script> <script id="templates/home.html" type="text/ng-template"> <div ng-include="'sub/home.html'"></div> </script> <script id="templates/news.html" type="text/ng-template"> <div ng-include="'sub/news.html'"></div> </script> ....
home.html:
<ion-view view-title="" hide-nav-bar="true"> <ion-content class="padding app-home" scroll="false"> <div class="app-image"> <img class="full-image" src="img/app-logo.svg"> </div> <div class="row app-home-buttons"> <div class="col"> <a href="#/tab/news"> <button class="button button-balanced button-block icon-top"><i class='icon ion-ios-paper-outline'></i><span>News</span> </button> </a> </div> </ion-content> </ion-view>
news.html:
<ion-view view-title="News" ng-controller="NewsRefreshCtrl"> <ion-content class=""> <ion-refresher on-refresh="doRefresh()"> </ion-refresher> <div class="list"> <a class="item item-thumbnail-left item-text-wrap" href="#"> <img src="img/tile-icon.png"> <h2>Lorem consetetur sadipscing</h2> <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At v</p> </a> </a> </div> </ion-content> </ion-view>
Now I have a problem that the panel with the site name no longer works. It does not show the name, and the html content included in it lies at the top under the panel. Maybe because because of the inclusion in the tag div now?
How can i solve this?
source share